-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathresultat.php
49 lines (33 loc) · 1.59 KB
/
resultat.php
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
<?php
try {
$bdd = new PDO('mysql:host=localhost;dbname=Otechnologie;charset=utf8', 'root', '');
} catch (Exception $e) {
die('Erreur : ' . $e->getMessage());
}
$q = $_REQUEST["q"];
$hint = "";
// lookup all hints from array if $q is different from ""
if ($q !== "") {
if ($hint === "") {
$reponse = $bdd->query("SELECT * from produit where referance like '%$q%'");
while ($donnees = $reponse->fetch() ){
$hint= '
<tr>
<td><input type="radio" name="radio_id" value="'.$donnees['id'].'" class="id_radio"></td>
<td>'.$donnees['id'].'</td>
<td>'.$donnees['categorie'].'</td>
<td>'.$donnees['marque'].'</td>
<td>'.$donnees['model'].'</td>
<td>'.$donnees['referance'].'</td>
<td><img src="produit/'.$donnees['img'].'" style="width:50px"></td>
<td><span style="background:'.$donnees['color'].'"></span></td>
<td>'.$donnees['quantite'].'</td>
<td>'.$donnees['prix'].'</td>
<td>'.$donnees['date_entre'].'</td>
</tr>';
}
}
}
// Output "no suggestion" if no hint was found or output correct values
echo $hint === "" ? "<tr><td colspan=\"11\"><h3 style=\"text-align:center;font:400 19px/20px Poppins-Regular,'Open Sans','Helvetica Neue',Arial,sans-serif;\">Aucun produit a cette référance</h3></td></tr>" : $hint;
?>