Bonjour,j'ai un problème que je n'arrive pas à résoudre !
J'ai créé un formulaire le voici :
Ce formulaire porte son action vers un fichier php qui est sensé vérifier si les données que j'ai mises dans le formulaire correspondent à l'une de mes lignes dans une table de ma base de données.Si les informations correspondent à une des lignes alors j'affiche toute la ligne de ma table :
Code : 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 <html> <head> <title>Formulaire recherche licencie</title> </head> <body> <table border="2" width="50%" align="center"> <tr> <td width="50%" bgcolor="#A6CAF0"> <form name="licencie" method="post" action="licencie.php"> <table> <tr><td><input type="text" name="nom_licencie" value="Nom"></td></tr> <tr><td><input type="text" name="prenom_licencie" value="Prenom"></td></tr> <tr><td><input type="text" name="club_d_affiliation" value="Club"></td></tr> <tr><td><input type="text" name="numero_licence" value="Numero licence"></td></tr> <tr><td><input type="submit" value="Rechercher licencie"></td></tr> </table> </form> </body> </html>
Voici le fichier php :
En soumettant le formulaire et même en allant directement sur mon fichier php j'ai l'erreur suivante qui s'affiche :
Code : 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 <?php error_reporting(E_ALL); $host="localhost"; $user="root"; $pass=""; $db="affilie"; mysql_connect($host,$user,$pass) or die("Impossible de se connecter à la base de donnée : $db"); mysql_select_db($db) or die("Impossible de se connecter à la base de donnée"); $query="SELECT * FROM licencie WHERE nom_licencie=$_POST['nom_licencie'] AND prenom_licencie=$_POST['prenom_licencie'] AND club_d_affiliation=$_POST['club_d_affiliation'] AND numero_licence=$_POST['numero_licence']"; $result = mysql_db_query($db,$query); echo"<table>\n"; while($affiche=mysql_fetch_assoc($result)) { echo "<td>$affiche['nom_licencie']</td>" ; echo "</tr>" ; echo "<td>$affiche['prenom_licencie']</td>" ; echo "</tr>" ; echo "<td>$affiche['ville_licencie']</td>" ; echo "</tr>" ; echo "<td>$affiche['adresse_licencie']</td>" ; echo "</tr>" ; echo "<td>$affiche['club_d_affiliation']</td>" ; echo "</tr>" ; echo "<td>$affiche['numero_licence']</td>" ; echo "</tr>" ; } echo"</table>"; ?>
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Users\GuIpE\Desktop\projet_web\licencie.php on line 15
Je vois pas mon problème.Merci de m'aider !
Partager