Bonsoir !
je developpe mon site internet en PHP, cependant je ne sais pas comment faire ma requete.
La requete SQL doit permettre de trouver un produit dans la base de données en faisant la recherche sur plusieurs criteres.
J'ai deja fait ca mais cette requete fontionne pas correctement
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 <?php $connexion = mysql_connect("localhost","root",""); if ($connexion) { // connexion réussie mysql_select_db("bijouterie",$connexion); $requete="select * from bijoux where Nom like '%".$_POST["nom"]."%' and id_bijoux like '".$_POST["ref"]."';"; $resultat = mysql_query($requete) or die ('Erreur SQL !<br />'.$requete.'<br />'.mysql_error()); $ligne = mysql_fetch_assoc($resultat); if ($ligne) //Si on trouve un produit afficher le tableau ou il apparaitra { echo '<p><table border="4" width="75%"></p>'; echo '<tr><th width="15%">id_bijoux</th><th width="19%">Nom</th><th width="37%">descriptif</th><th width="14%">Prix</th><th width="13%">image</th></tr>'; while($ligne) { echo '<tr>'; echo '<td>'.$ligne["id_bijoux"].'</td>'; echo '<td>'.$ligne["Nom"].'</td>'; echo '<td>'.$ligne["Descriptif"].'</td>'; echo '<td>'.$ligne["Prix"].'</td><br/>'; echo '<td><img src="./images/'.$ligne["image"].'.jpg" /></td>'; $ligne=mysql_fetch_assoc($resultat); } }
Je vous remercie![]()
Partager