Bonjour,
j'ai saisi dans un fichier index.php le code suivant (il est volontairement tronqué avant et aprés par soucis de rapidité et de clarté)
Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126 <table border="1" bgcolor=yellow> <caption><font face=verdana size=2><b>Données relatives à l'individu</b></font></caption> <tr> <td width=90> <font face=verdana size=1>Type Action</font> </td> <td width=90> <input type="listbox" name="type_action" value="type action"size="10"> </td> <td width=90> <font face=verdana size=1>Heure</font> </td> <td width=90> <input type="text" name="heure" value="heure" size="10"> </td> <td width=90> <font face=verdana size=1>Sexe</font> </td> <td width=90> <input type="listbox" name="sexe" value="sexe" size="10"> </td> <td width=90> <font face=verdana size=1>Age</font> </td> <td width=90> <input type="text" name="age" value="age" size="2"> </tr> <tr> <td> <font face=verdana size=1>Numero bague</font> </td> <td> <input type="texte" name="num_bague" value="num_bague" size="10"> </td> <td> <font face=verdana size=1>CS</font> </td> <td> <input type="listbox" name="CS" value="CS" size="10"> </td> <td> <font face=verdana size=1>PC</font> </td> <td> <input type="checkbox" name="PC"> </td> <td> <font face=verdana size=1>PI</font> </td> <td> <input type="checkbox" name="PI"> </td> </tr> <tr> <td width=90> <font face=verdana size=1>NF</font> </td> <td width=90> <input type="text" name="NF" value="NF" size="10"> </td> <td width=90> <font face=verdana size=1>PA</font> </td> <td width=90> <input type="text" name="PA" value="PA" size="10"> </td> <td width=90> <font face=verdana size=1>CA</font> </td> <td width=90> <input type="text" name="CA" value="CA" size="10"> </td> <td width=90> <font face=verdana size=1>Condition reprise</font> </td> <td width=90> <input type="text" name="Cond_repr" value="Cond_repr" size="2"> </tr> <tr> <td width=90> <font face=verdana size=1>Circonstances reprise</font> </td> <td width=90> <input type="text" name="Circ_repr" value="Circ_repr" size="10"> </td> <td width=90> <font face=verdana size=1>AS</font> </td> <td width=90> <input type="text" name="AS" value="AS" size="10"> </td> <td width=90> <font face=verdana size=1>CR</font> </td> <td width=90> <input type="listbox" name="CR" value="CR" size="10"> </td> <td width=90> <font face=verdana size=1>FM</font> </td> <td width=90> <input type="text" name="FM" value="FM" size="2"> </tr> <tr> <td width=90> <font face=verdana size=1>FR</font> </td> <td width=90> <input type="text" name="FR" value="FR" size="10"> </td> <td> <font face=verdana size=1>Mémo</font> </td> <td colspan=5> <input type="textbox" name="Mémo" value="Mémo" size="75"> </td> <TR> <td colspan="8"> <center><input type="button" value="Nouvelle donnée individu" OnClick="javascript:RAS(23);javascript:RAS(24); javascript:RAS(25);javascript:RAS(26);javascript:RAS(27);javascript:RAS(28);javascript:RAS(29);javascript:RAS(30); javascript:RAS(31);javascript:RAS(32);javascript:RAS(33);javascript:RAS(34);javascript:RAS(35);javascript:RAS(36); javascript:RAS(37);javascript:RAS(38);javascript:RAS(39);javascript:RAS(40);"></center> </td> </TR> </tr> </table>
Dans un second temps, je cherche à executer la requete suivante stockée dans mon fichier : add.php
(la variable $ID_action etant une variable recupérée d'un identifiant automatique un peu plus haut dans la partie tronquée du code)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 $db = mysql_connect('localhost', 'root', '') or die('Erreur de connexion '.mysql_error()); mysql_select_db('bd_bagage',$db) or die('Erreur de selection '.mysql_error()); $sql = "INSERT INTO individu(ID_type_action,Sexe,Age,Bague,CS,Heure,NF,PA,CA,Memo,Cond_repr,Circ_repr,AS,FM,FR,ID_station) VALUES('$type_action','$sexe','$age','$num_bague','$CS','$heure','$PC','$PA','$CA','$Mémo','$Cond_repr','$Circ_repr','$AS','$FM','$FR','$ID_station')"; mysql_query($sql) or die('Erreur SQL !'.$sql.'<br><br>'.mysql_error()); echo '<center><b>La donnée à été correctement ajoutée à la base.</b></center>'; echo'<center><form><input type="button" value="Retour" OnClick="javascript:history.back()"></form></center>'; mysql_close(); // on ferme la connexion
Cependant : à l'execution de la requete : voici le message d'erreur :
Erreur SQL !INSERT INTO individu(ID_type_action,Sexe,Age,Bague,CS,Heure,NF,PA,CA,Memo,Cond_repr,Circ_repr,AS,FM,FR,ID_station) VALUES('type action','sexe','age','num_bague','CS','heure','','PA','CA','Mémo','Cond_repr','Circ_repr','AS','FM','FR','')
Erreur de syntaxe près de 'AS,FM,FR,ID_station) VALUES('type action','sexe','age','num_bagu' à la ligne 1
Je désèspère à trouver la partie du code qui pose problème
Partager