1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <?php
$nom=$_POST["nom"];
$passwd=$_POST["passwd"];
$db = mysql_connect("localhost", $nom, $passwd);
mysql_select_db("boulangerie",$db);
$n_client=$_POST["n_client"];
$raison_sociale=$_POST["raison_sociale"];
$adresse=$_POST["adresse"];
$ville=$_POST["ville"];
$code_postal=$_POST["code_postal"];
$telephone=$_POST["telephone"];
$code_categorie=$_POST["code_categorie"];
$reponse = mysql_query("SELECT n_client FROM Clients WHERE n_client='".$n_client."'");
$nb=mysql_num_rows ($reponse);
if($nb!=0)
{
echo "Ce numero client est deja attribué.";
}
else {
$reponse2 = mysql_query("INSERT INTO `boulangerie`.`Clients`(`n_client`,`raison_sociale`,`adresse`,`ville`,`code_postal`,`telephone`,`code_categorie`)
VALUES('$n_client','$raison_sociale','$adresse','$ville',`$code_postal`,`$telephone`,`$code_categorie`);");
echo"Votre ajout a été effectué." ;
}
mysql_close();
?> |
Partager