I want to add data to different tables
Fermé
ssendu
Messages postés
6
Date d'inscription
dimanche 26 juillet 2009
Statut
Membre
Dernière intervention
2 septembre 2009
-
27 juil. 2009 à 17:12
blux Messages postés 24894 Date d'inscription dimanche 26 août 2001 Statut Modérateur Dernière intervention 28 mars 2023 - 27 juil. 2009 à 20:32
blux Messages postés 24894 Date d'inscription dimanche 26 août 2001 Statut Modérateur Dernière intervention 28 mars 2023 - 27 juil. 2009 à 20:32
A voir également:
- I want to add data to different tables
- Youtube to mp4 conconventer - Forum Vidéo/TV
- Cam to cam - Forum Internet / Réseaux sociaux
- Qwerty to azerty - Guide
- 1 to ✓ - Forum Windows
- Convertisseur youtube to mp3 conconventer ✓ - Forum Logiciels
7 réponses
necrowater1997
Messages postés
81
Date d'inscription
jeudi 2 juillet 2009
Statut
Membre
Dernière intervention
16 mars 2010
3
27 juil. 2009 à 17:13
27 juil. 2009 à 17:13
go to:
https://ccm.net/
https://ccm.net/
ssendu
Messages postés
6
Date d'inscription
dimanche 26 juillet 2009
Statut
Membre
Dernière intervention
2 septembre 2009
27 juil. 2009 à 17:16
27 juil. 2009 à 17:16
Sorry, but what is that?? Can you please specify why the website is useful??
lecube
Messages postés
304
Date d'inscription
samedi 14 mars 2009
Statut
Membre
Dernière intervention
13 avril 2010
54
27 juil. 2009 à 17:18
27 juil. 2009 à 17:18
Hy,
I think it would be better from you to write the part of you code where you have your problem. It is not so easy to undertsand without any lines ... :-(
Regards
I think it would be better from you to write the part of you code where you have your problem. It is not so easy to undertsand without any lines ... :-(
Regards
ssendu
Messages postés
6
Date d'inscription
dimanche 26 juillet 2009
Statut
Membre
Dernière intervention
2 septembre 2009
27 juil. 2009 à 17:25
27 juil. 2009 à 17:25
OK thanks aloot lecube.
Here is the code:
<?php
$conn= mysql_connect("localhost", "root", ""); // Connexion à MySQL
mysql_select_db("test"); // Sélection de la base coursphp
if (isset($_POST['Submit']))
{
$a = $_POST['client'];
$b = $_POST['env'];
$c = $_POST['machine'];
$result1= mysql_query("INSERT INTO client(nom_client) VALUES ('$a')");
$exec= mysql_query($result1, $conn);
$code_client=mysql_insert_id();
printf("le dernier ID1 %d\n", mysql_insert_id());
$result3=mysql_query("INSERT INTO machine(Nom_machine) VALUES ('$c')");
$exec= mysql_query($result3,$conn);
$id_machine=mysql_insert_id();
printf("le dernier ID2 %d\n", mysql_insert_id());
$result2= mysql_query("INSERT INTO environnement VALUES (NULL,'$b',".$code_client.",".$id_machine.")");
$exec= mysql_query($result2,$conn);
echo "\ndata2 inserted";
mysql_close($conn);
echo "\ndata inserted\n"; // Déconnexion de MySQL
}
?>
Here is the code:
<?php
$conn= mysql_connect("localhost", "root", ""); // Connexion à MySQL
mysql_select_db("test"); // Sélection de la base coursphp
if (isset($_POST['Submit']))
{
$a = $_POST['client'];
$b = $_POST['env'];
$c = $_POST['machine'];
$result1= mysql_query("INSERT INTO client(nom_client) VALUES ('$a')");
$exec= mysql_query($result1, $conn);
$code_client=mysql_insert_id();
printf("le dernier ID1 %d\n", mysql_insert_id());
$result3=mysql_query("INSERT INTO machine(Nom_machine) VALUES ('$c')");
$exec= mysql_query($result3,$conn);
$id_machine=mysql_insert_id();
printf("le dernier ID2 %d\n", mysql_insert_id());
$result2= mysql_query("INSERT INTO environnement VALUES (NULL,'$b',".$code_client.",".$id_machine.")");
$exec= mysql_query($result2,$conn);
echo "\ndata2 inserted";
mysql_close($conn);
echo "\ndata inserted\n"; // Déconnexion de MySQL
}
?>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
ssendu
Messages postés
6
Date d'inscription
dimanche 26 juillet 2009
Statut
Membre
Dernière intervention
2 septembre 2009
27 juil. 2009 à 17:38
27 juil. 2009 à 17:38
Please can any one help on debugging this code and figure out what is the problem!!!!
:(
Thanks in advance
:(
Thanks in advance
lecube
Messages postés
304
Date d'inscription
samedi 14 mars 2009
Statut
Membre
Dernière intervention
13 avril 2010
54
27 juil. 2009 à 20:00
27 juil. 2009 à 20:00
I don't see any problem in your code :-(
Which data is not inserted ? The second and the third or only the third one ?
Which data is not inserted ? The second and the third or only the third one ?
blux
Messages postés
24894
Date d'inscription
dimanche 26 août 2001
Statut
Modérateur
Dernière intervention
28 mars 2023
3 315
27 juil. 2009 à 20:32
27 juil. 2009 à 20:32
Salut,
merci de poster ce message sur la version anglaise du site :
please open a new topic on the english version of this site :
http://en.kioskea.net/forum/forum-3-programming
I close this one. Je ferme
merci de poster ce message sur la version anglaise du site :
please open a new topic on the english version of this site :
http://en.kioskea.net/forum/forum-3-programming
I close this one. Je ferme