PHP|Débutant :: Forums

Advertisement

Besoin d'aide ? N'hésitez pas, mais respectez les règles

Vous n'êtes pas identifié(e).

#1 Forum Général PHP » sql manager for mysql, problème sur une page généré en PHP? » 13-05-2012 20:05:59

FOLLACO
Réponses : 4

Bonjour à tous,

Pouvez-vous m'aider à régler le problème suivant : J'ai généré une page PHP qui affiche des données mysql. Tout d'abord la page affiche une liste sous forme de tableau puis me propose de cliquer sur un bouton situé à gauche de chaque ligne pour accéder à un formulaire. Pourquoi lorsque je clique sur les liens : 'modifier', 'ajouter' et 'supprimer' cela ne fonctionne pas? Je souhaite modifier mes données depuis les champs affichés dans le formulaire.

Pour information, la page et généré depuis "sql manager for mysql".

Merci par avance pour vos réponses.
Ludovic.

<?php session_start(); ?>
<?php
  $_SESSION['my_user'] = "root";
  $_SESSION['my_pass'] = "";
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
body {
    background: #333399;
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12pt;
}
A:link { color: #69EF7D }
A:visited { color: #FF00FF }
A:active { color: #00FF00 }
.ThRows {
    background-color: #FF0000;
    color: #FFFFFF;
    font-weight: bold; text-align: center;
    font-family: Arial;
    font-size: 12pt;
}
.TrRows {
    background-color: #007AEC;
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12pt;
}
.TrOdd  {
    background-color: #006BCE;
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12pt;
}
.TrBC { background-color: #000000 }
</style>
</head>
<body>
<table width="100%"><tr><td class="ThRows">
Liste des contacts
</td></tr></table>

<?php
  $conn = connect();
  $showrecs = 200;
  $pagerange = 10;
  $a = @$_GET["a"];
  $recid = @$_GET["recid"];
  $page = @$_GET["page"];
  if (!isset($page)) $page = 1;

  $sql = @$_POST["sql"];

  switch ($sql) {
    case "insert":
      sql_insert();
      break;
    case "update":
      sql_update();
      break;
    case "delete":
      sql_delete();
      break;
  }

  switch ($a) {
    case "view":
      viewrec($recid);
      break;
    default:
      select();
      break;
  }
  mysql_close($conn);
?>
<table width="100%"><tr><td class="ThRows">
Créé par Ludovic FOLLACO
</td></tr></table>

</body>
</html>
<?php
function connect()
{
  $c = mysql_connect("localhost:3306", $_SESSION['my_user'], $_SESSION['my_pass']);
  mysql_select_db("contact");
  return $c;
}
?>
<?php
function sql_getrecordcount()
{
  global $conn;
  $sql = "select count(*) from (SELECT
  `contact`.`nomContact`,
  `contact`.`prenomContact`,
  `contact`.`telephoneContact`,
  `contact`.`telephonePortableContact`,
  `contact`.`emailContact`,
  `pays`.`nomPays`,
  `commune`.`nomCommune`,
  `commune`.`codePostalCommune`,
  `fonctioncontact`.`nomFonctionContact`,
  `serviceclient`.`nomServiceClient`,
  `siteclient`.`nomDuSiteClient`,
  `siteclient`.`adresse1SiteClient`,
  `siteclient`.`telephonesiteClient`,
  `client`.`nomClient`
FROM
  `siteclient`
  INNER JOIN `client` ON (`siteclient`.`clientSiteClient` = `client`.`nomClient`)
  INNER JOIN `contact` ON (`siteclient`.`nomDuSiteClient` = `contact`.`siteContact`)
  INNER JOIN `commune` ON (`siteclient`.`communeSiteClient` = `commune`.`nomCommune`)
  INNER JOIN `pays` ON (`commune`.`paysCommune` = `pays`.`nomPays`)
  INNER JOIN `serviceclient` ON (`contact`.`serviceContact` = `serviceclient`.`nomServiceClient`)
  INNER JOIN `fonctioncontact` ON (`contact`.`fonctionContact` = `fonctioncontact`.`nomFonctionContact`)
) q"
;
  $res = mysql_query($sql, $conn) or die(mysql_error());
  $row = mysql_fetch_assoc($res);
  reset($row);
  return current($row);
}
?>
<?php
function sql_select()
{
  global $conn;
  $sql = "SELECT
  `contact`.`nomContact`,
  `contact`.`prenomContact`,
  `contact`.`telephoneContact`,
  `contact`.`telephonePortableContact`,
  `contact`.`emailContact`,
  `pays`.`nomPays`,
  `commune`.`nomCommune`,
  `commune`.`codePostalCommune`,
  `fonctioncontact`.`nomFonctionContact`,
  `serviceclient`.`nomServiceClient`,
  `siteclient`.`nomDuSiteClient`,
  `siteclient`.`adresse1SiteClient`,
  `siteclient`.`telephonesiteClient`,
  `client`.`nomClient`
FROM
  `siteclient`
  INNER JOIN `client` ON (`siteclient`.`clientSiteClient` = `client`.`nomClient`)
  INNER JOIN `contact` ON (`siteclient`.`nomDuSiteClient` = `contact`.`siteContact`)
  INNER JOIN `commune` ON (`siteclient`.`communeSiteClient` = `commune`.`nomCommune`)
  INNER JOIN `pays` ON (`commune`.`paysCommune` = `pays`.`nomPays`)
  INNER JOIN `serviceclient` ON (`contact`.`serviceContact` = `serviceclient`.`nomServiceClient`)
  INNER JOIN `fonctioncontact` ON (`contact`.`fonctionContact` = `fonctioncontact`.`nomFonctionContact`)
"
;
  $res = mysql_query($sql, $conn) or die(mysql_error());
  return $res;
}

function select(){
  global $showrecs;
  global $pagerange;
  global $page;
  global $conn;
  $res = sql_select();
  $count = sql_getrecordcount();
  if ($count % $showrecs != 0) {
    $pagecount = intval($count / $showrecs) + 1;
  }
  else {
    $pagecount = intval($count / $showrecs);
  }
  $startrec = $showrecs * ($page - 1);
  if ($startrec < $count) {mysql_data_seek($res, $startrec);}
  $reccount = min($showrecs * $page, $count);
?>
<?php showpagenav($page, $pagecount); ?>
<table width="100%" border="0" cellpadding="4" cellspacing="1">
  <tr>
    <td class="ThRows"> </td>
    <td class="ThRows">nomContact</td>
    <td class="ThRows">prenomContact</td>
    <td class="ThRows">telephoneContact</td>
    <td class="ThRows">telephonePortableContact</td>
    <td class="ThRows">emailContact</td>
    <td class="ThRows">nomPays</td>
    <td class="ThRows">nomCommune</td>
    <td class="ThRows">codePostalCommune</td>
    <td class="ThRows">nomFonctionContact</td>
    <td class="ThRows">nomServiceClient</td>
    <td class="ThRows">nomDuSiteClient</td>
    <td class="ThRows">adresse1SiteClient</td>
    <td class="ThRows">telephonesiteClient</td>
    <td class="ThRows">nomClient</td>
  </tr>
<?php
if(mysql_num_rows($res)) {
  for ($i = $startrec; $i < $reccount; $i++)
  {
    $row = mysql_fetch_assoc($res);
    $s = "TrOdd";
    if ($i % 2 == 0) {
      $s = "TrRows";
    }
?>
  <tr>
    <td class="<?php echo $s?>" width = "16"><a href="query_result.php?a=view&recid=<?php echo $i ?>" ><img src="ems_php_images\phpview.jpg" title="Vue des enregistrements" border="0"></a></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['nomContact'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['prenomContact'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['telephoneContact'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['telephonePortableContact'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['emailContact'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['nomPays'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['nomCommune'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['codePostalCommune'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['nomFonctionContact'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['nomServiceClient'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['nomDuSiteClient'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['adresse1SiteClient'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['telephonesiteClient'])?></td>
    <td class="<?php echo $s?>"><?php echo htmlspecialchars($row['nomClient'])?></td>
  </tr>
<?php }mysql_free_result($res);}?>
</table>
<?php showpagenav($page, $pagecount); ?>
<?php }?>
<?php function showpagenav($page, $pagecount){ ?>
<table border="0" width="100%"
<tr>
<?php if ($page > 1) { ?>
<a href="query_result.php?page=<?php echo $page - 1 ?>"><< Prev</a> 
<?php } ?>
<?php
global $pagerange;
if ($pagecount > 1) {
  if ($pagecount % $pagerange != 0)
    $rangecount = intval($pagecount / $pagerange) + 1;
  else
    $rangecount = intval($pagecount / $pagerange);
  for ($i = 1; $i < $rangecount + 1; $i++) {
    $startpage = (($i - 1) * $pagerange) + 1;
    $count = min($i * $pagerange, $pagecount);
    if ((($page >= $startpage) && ($page <= ($i * $pagerange)))) {
      for ($j = $startpage; $j < $count + 1; $j++) {
        if ($j == $page) {
?>
<b><?php echo $j ?></b>
<?php } else { ?>
<a href="query_result.php?page=<?php echo $j ?>"><?php echo $j ?></a>
<?php } } } else { ?>
<a href="query_result.php?page=<?php echo $startpage ?>"><?php echo $startpage ."..." .$count ?></a>
<?php } } } ?>
<?php if ($page < $pagecount) { ?>
 <a href="query_result.php?page=<?php echo $page + 1 ?>">Précédent >></a> </td>
<?php } ?>
</tr>
</table>
<?php } ?>

<?php function showrecnav($a, $recid, $count)
{
?>
<table border="0" cellspacing="1" cellpadding="4">
<tr>
<td><a href="query_result.php">Liste</a></td>
<?php if ($recid > 0) { ?>
<td><a href="query_result.php?a=<?php echo $a ?>&recid=<?php echo $recid - 1 ?>">Précédent</a></td>
<?php } if ($recid < $count - 1) { ?>
<td><a href="query_result.php?a=<?php echo $a ?>&recid=<?php echo $recid + 1 ?>">Suivant</a></td>
<?php } ?>
</tr>
</table>
<hr size="1" noshade>
<?php } ?>

<?php function showrow($row, $recid)
  {
?>
<table border="0" cellspacing="1" cellpadding="5" width="50%">
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomContact")." " ?></td>
<td class="TrRows"><?php echo htmlspecialchars($row["nomContact"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("prenomContact")." " ?></td>
<td class="TrOdd"><?php echo htmlspecialchars($row["prenomContact"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("telephoneContact")." " ?></td>
<td class="TrRows"><?php echo htmlspecialchars($row["telephoneContact"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("telephonePortableContact")." " ?></td>
<td class="TrOdd"><?php echo htmlspecialchars($row["telephonePortableContact"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("emailContact")." " ?></td>
<td class="TrRows"><?php echo htmlspecialchars($row["emailContact"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomPays")." " ?></td>
<td class="TrOdd"><?php echo htmlspecialchars($row["nomPays"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomCommune")." " ?></td>
<td class="TrRows"><?php echo htmlspecialchars($row["nomCommune"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("codePostalCommune")." " ?></td>
<td class="TrOdd"><?php echo htmlspecialchars($row["codePostalCommune"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomFonctionContact")." " ?></td>
<td class="TrRows"><?php echo htmlspecialchars($row["nomFonctionContact"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomServiceClient")." " ?></td>
<td class="TrOdd"><?php echo htmlspecialchars($row["nomServiceClient"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomDuSiteClient")." " ?></td>
<td class="TrRows"><?php echo htmlspecialchars($row["nomDuSiteClient"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("adresse1SiteClient")." " ?></td>
<td class="TrOdd"><?php echo htmlspecialchars($row["adresse1SiteClient"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("telephonesiteClient")." " ?></td>
<td class="TrRows"><?php echo htmlspecialchars($row["telephonesiteClient"]) ?></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomClient")." " ?></td>
<td class="TrOdd"><?php echo htmlspecialchars($row["nomClient"]) ?></td>
</tr>
</table>
<?php } ?>

<?php
function select_fk_keys($tablename, $fieldname){
  global $conn;
  $sql = "SELECT $fieldname FROM $tablename;";
  $res = mysql_query($sql, $conn) or die(mysql_error());
  return $res;
}
?>
<?php function showroweditor($row, $iseditmode)
  {
?>
<table border="0" cellspacing="1" cellpadding="5"width="50%">
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomContact")." " ?></td>
<td class="TrRows">
<textarea name="nomContact" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["nomContact"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("prenomContact")." " ?></td>
<td class="TrRows">
<textarea name="prenomContact" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["prenomContact"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("telephoneContact")." " ?></td>
<td class="TrRows">
<textarea name="telephoneContact" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["telephoneContact"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("telephonePortableContact")." " ?></td>
<td class="TrRows">
<textarea name="telephonePortableContact" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["telephonePortableContact"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("emailContact")." " ?></td>
<td class="TrRows">
<textarea name="emailContact" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["emailContact"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomPays")." " ?></td>
<td class="TrRows">
<textarea name="nomPays" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["nomPays"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomCommune")." " ?></td>
<td class="TrRows">
<textarea name="nomCommune" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["nomCommune"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("codePostalCommune")." " ?></td>
<td class="TrRows">
<textarea name="codePostalCommune" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["codePostalCommune"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomFonctionContact")." " ?></td>
<td class="TrRows">
<textarea name="nomFonctionContact" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["nomFonctionContact"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomServiceClient")." " ?></td>
<td class="TrRows">
<textarea name="nomServiceClient" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["nomServiceClient"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomDuSiteClient")." " ?></td>
<td class="TrRows">
<textarea name="nomDuSiteClient" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["nomDuSiteClient"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("adresse1SiteClient")." " ?></td>
<td class="TrRows">
<textarea name="adresse1SiteClient" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["adresse1SiteClient"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("telephonesiteClient")." " ?></td>
<td class="TrRows">
<textarea name="telephonesiteClient" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["telephonesiteClient"]))?></textarea></td>
</tr>
<tr>
<td class="ThRows"><?php echo htmlspecialchars("nomClient")." " ?></td>
<td class="TrRows">
<textarea name="nomClient" cols="36" rows="4"><?php echo str_replace('"', '"', trim($row["nomClient"]))?></textarea></td>
</tr>
</tr>
</table>
<?php } ?>

<?php function addrec()
{
?>
<table border="0" cellspacing="1" cellpadding="4">
<tr>
<td><a href="query_result.php">Liste</a></td>
</tr>
</table>
<hr size="1" noshade>
<form enctype="multipart/form-data" action="query_result.php" method="post">
<p><input type="hidden" name="sql" value="insert"></p>
<?php
$row = array(
  "nomContact" => "",
  "prenomContact" => "",
  "telephoneContact" => "",
  "telephonePortableContact" => "",
  "emailContact" => "",
  "nomPays" => "",
  "nomCommune" => "",
  "codePostalCommune" => "",
  "nomFonctionContact" => "",
  "nomServiceClient" => "",
  "nomDuSiteClient" => "",
  "adresse1SiteClient" => "",
  "telephonesiteClient" => "",
  "nomClient" => "");
showroweditor($row, false);
?>
<p><input type="submit" name="action" value="Post"></p>
</form>
<?php } ?>

<?php function viewrec($recid)
{
$res = sql_select();
  $count = sql_getrecordcount();
  mysql_data_seek($res, $recid);
  $row = mysql_fetch_assoc($res);
  showrecnav("view", $recid, $count);
?>
<br>
<?php showrow($row, $recid) ?>
<br>
<hr size="1" noshade>
<table border="0" cellspacing="1" cellpadding="4">
<tr>
<td><a href="query_result.php?a=edit&recid=<?php echo $recid ?>">Modifier</a></td>
<td><a href="query_result.php?a=del&recid=<?php echo $recid ?>">Supprimer</a></td>
</tr>
</table>
<?php
  mysql_free_result($res);
} ?>

<?php function editrec($recid)
{
  $res = sql_select();
  $count = sql_getrecordcount();
  mysql_data_seek($res, $recid);
  $row = mysql_fetch_assoc($res);
  showrecnav("edit", $recid, $count);
?>
<br>
<form enctype="multipart/form-data" action="query_result.php" method="post">
<input type="hidden" name="sql" value="update">
<input type="hidden" name="xidSiteClient" value="<?php echo $row["idSiteClient"] ?>">
<?php showroweditor($row, true); ?>
<p><input type="submit" name="action" value="Post"></p>
</form>
<?php
  mysql_free_result($res);
} ?>
<?php function deleterec($recid)
{
  $res = sql_select();
  $count = sql_getrecordcount();
  mysql_data_seek($res, $recid);
  $row = mysql_fetch_assoc($res);
?>
<br>
<form name="delete_form" action="query_result.php" method="post">
<input type="hidden" name="sql" value="delete">
<input type="hidden" name="xidSiteClient" value="<?php echo $row["idSiteClient"] ?>">
<script type="text/javascript">
  document.getElementById("delete_form").submit();
</script>
</form>
<?php
  mysql_free_result($res);
} ?>
<?php
function sqlvalue($val, $quote)
{
  if ($quote)
    $tmp = sqlstr($val);
  else
    $tmp = $val;
  if ($tmp == "")
    $tmp = "NULL";
  elseif ($quote)
    $tmp = "'".$tmp."'";
  return $tmp;
}

function sqlstr($val)
{
  return str_replace("'", "''", $val);
}

function primarykeycondition()
{
  global $_POST;
  $pk = "";
  $pk .= "(`idSiteClient`";
  if (@$_POST["xidSiteClient"] == "") {
    $pk .= " IS NULL";
  } else {
  $pk .= " = " .sqlvalue(@$_POST["xidSiteClient"], false);
  };
  $pk .= ")";
  return $pk;
}

function sql_insert()
{
  global $conn;
  global $_POST;
  $sql = "insert into  (`idSiteClient`, `activeSiteClient`, `clientSiteClient`, `nomDuSiteClient`, `adresse1SiteClient`, `adresse2SiteClient`, `adresse3SiteClient`, `communeSiteClient`, `telephonesiteClient`, `idClient`, `nomClient`, `siteInternetClient`, `activeClient`, `idContact`, `activeContact`, `nomContact`, `prenomContact`, `serviceContact`, `fonctionContact`, `telephoneContact`, `telephonePortableContact`, `emailContact`, `siteContact`, `idCommune`, `activeCommune`, `paysCommune`, `nomCommune`, `codePostalCommune`, `idPays`, `activePays`, `nomPays`, `idServiceclient`, `activeServiceClient`, `nomServiceClient`, `idFonctionContact`, `activeFonctionContact`, `nomFonctionContact`) values (".sqlvalue(@$_POST["idSiteClient"], false).", ".sqlvalue(@$_POST["activeSiteClient"], false).", ".sqlvalue(@$_POST["clientSiteClient"], true).", ".sqlvalue(@$_POST["nomDuSiteClient"], true).", ".sqlvalue(@$_POST["adresse1SiteClient"], true).", ".sqlvalue(@$_POST["adresse2SiteClient"], true).", ".sqlvalue(@$_POST["adresse3SiteClient"], true).", ".sqlvalue(@$_POST["communeSiteClient"], true).", ".sqlvalue(@$_POST["telephonesiteClient"], true).", ".sqlvalue(@$_POST["idClient"], false).", ".sqlvalue(@$_POST["nomClient"], true).", ".sqlvalue(@$_POST["siteInternetClient"], true).", ".sqlvalue(@$_POST["activeClient"], false).", ".sqlvalue(@$_POST["idContact"], false).", ".sqlvalue(@$_POST["activeContact"], false).", ".sqlvalue(@$_POST["nomContact"], true).", ".sqlvalue(@$_POST["prenomContact"], true).", ".sqlvalue(@$_POST["serviceContact"], true).", ".sqlvalue(@$_POST["fonctionContact"], true).", ".sqlvalue(@$_POST["telephoneContact"], true).", ".sqlvalue(@$_POST["telephonePortableContact"], true).", ".sqlvalue(@$_POST["emailContact"], true).", ".sqlvalue(@$_POST["siteContact"], true).", ".sqlvalue(@$_POST["idCommune"], false).", ".sqlvalue(@$_POST["activeCommune"], false).", ".sqlvalue(@$_POST["paysCommune"], true).", ".sqlvalue(@$_POST["nomCommune"], true).", ".sqlvalue(@$_POST["codePostalCommune"], true).", ".sqlvalue(@$_POST["idPays"], false).", ".sqlvalue(@$_POST["activePays"], false).", ".sqlvalue(@$_POST["nomPays"], true).", ".sqlvalue(@$_POST["idServiceclient"], false).", ".sqlvalue(@$_POST["activeServiceClient"], false).", ".sqlvalue(@$_POST["nomServiceClient"], true).", ".sqlvalue(@$_POST["idFonctionContact"], false).", ".sqlvalue(@$_POST["activeFonctionContact"], false).", ".sqlvalue(@$_POST["nomFonctionContact"], true).")";
  mysql_query($sql, $conn) or die(mysql_error());
}
?>
<?php
function sql_update()
{
  global $conn;
  global $_POST;
  $sql = "update  set `idSiteClient`=".sqlvalue(@$_POST["idSiteClient"], false).", `activeSiteClient`=".sqlvalue(@$_POST["activeSiteClient"], false).", `clientSiteClient`=".sqlvalue(@$_POST["clientSiteClient"], true).", `nomDuSiteClient`=".sqlvalue(@$_POST["nomDuSiteClient"], true).", `adresse1SiteClient`=".sqlvalue(@$_POST["adresse1SiteClient"], true).", `adresse2SiteClient`=".sqlvalue(@$_POST["adresse2SiteClient"], true).", `adresse3SiteClient`=".sqlvalue(@$_POST["adresse3SiteClient"], true).", `communeSiteClient`=".sqlvalue(@$_POST["communeSiteClient"], true).", `telephonesiteClient`=".sqlvalue(@$_POST["telephonesiteClient"], true).", `idClient`=".sqlvalue(@$_POST["idClient"], false).", `nomClient`=".sqlvalue(@$_POST["nomClient"], true).", `siteInternetClient`=".sqlvalue(@$_POST["siteInternetClient"], true).", `activeClient`=".sqlvalue(@$_POST["activeClient"], false).", `idContact`=".sqlvalue(@$_POST["idContact"], false).", `activeContact`=".sqlvalue(@$_POST["activeContact"], false).", `nomContact`=".sqlvalue(@$_POST["nomContact"], true).", `prenomContact`=".sqlvalue(@$_POST["prenomContact"], true).", `serviceContact`=".sqlvalue(@$_POST["serviceContact"], true).", `fonctionContact`=".sqlvalue(@$_POST["fonctionContact"], true).", `telephoneContact`=".sqlvalue(@$_POST["telephoneContact"], true).", `telephonePortableContact`=".sqlvalue(@$_POST["telephonePortableContact"], true).", `emailContact`=".sqlvalue(@$_POST["emailContact"], true).", `siteContact`=".sqlvalue(@$_POST["siteContact"], true).", `idCommune`=".sqlvalue(@$_POST["idCommune"], false).", `activeCommune`=".sqlvalue(@$_POST["activeCommune"], false).", `paysCommune`=".sqlvalue(@$_POST["paysCommune"], true).", `nomCommune`=".sqlvalue(@$_POST["nomCommune"], true).", `codePostalCommune`=".sqlvalue(@$_POST["codePostalCommune"], true).", `idPays`=".sqlvalue(@$_POST["idPays"], false).", `activePays`=".sqlvalue(@$_POST["activePays"], false).", `nomPays`=".sqlvalue(@$_POST["nomPays"], true).", `idServiceclient`=".sqlvalue(@$_POST["idServiceclient"], false).", `activeServiceClient`=".sqlvalue(@$_POST["activeServiceClient"], false).", `nomServiceClient`=".sqlvalue(@$_POST["nomServiceClient"], true).", `idFonctionContact`=".sqlvalue(@$_POST["idFonctionContact"], false).", `activeFonctionContact`=".sqlvalue(@$_POST["activeFonctionContact"], false).", `nomFonctionContact`=".sqlvalue(@$_POST["nomFonctionContact"], true)." where " .primarykeycondition();
  mysql_query($sql, $conn) or die(mysql_error());
}
?>
<?php
function sql_delete()
{
  global $conn;
  $sql = "delete from  where " .primarykeycondition();
  mysql_query($sql, $conn) or die(mysql_error());
}
?>

Pied de page des forums

Propulsé par FluxBB