Bonjour,

J'ai un petit problème avec mon moteur de recherche en PHP car lors du lancement de mes requêtes de recherche cela ne fonctionne pas il n'affiche rien pourrais je savoir pourquoi ?

Mon code :
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
<link rel="stylesheet" type="text/css" href="search.css" />
<div id="search">
<form method="GET">
<FONT color="black"><input type="search" name="q" id="barre" placeholder="Rechercher..." style="width: 303px;border-radius: 50px;height: 25px;text-decoration: none;border: 0; color: #000000; font-size: 15px;"></FONT></div>
   <input type="submit" value="Valider" />
</form>
<?php
 
$bdd = new PDO('mysql:host=localhost;dbname=toys', 'root', 'root');
?>
  <?php
if (!empty($_GET['q'])) {
    $sql = ('SELECT toys, id, FROM shop WHERE toys LIKE ?  ORDER BY id DESC');
    $sth = $bdd->prepare($sql);
    $sth->execute(array('%' . $_GET['q'] . '%'));
    while($data = $sth->fetch()) { ?>
    <label for="resultstyle"><div class="result"><li><a href="toys.php?id=<?php echo $data['id']; ?>&toys=<?php echo $data['toys']; ?>" style="text-decoration: none;"><img src="/images/toys.png" style="no-repeat center center/100% white; border-radius: 50%; display: inline-block; float: left; border: 3px solid #19c589; padding: 3px; -webkit-border-radius: 150px; width: 20px; height: 20px; vertical-align : middle; margin-top: 4px;" /><FONT color="white" style="margin-top: 5px;"><div id="datatoys" style="margin-top: 8px; margin-left: 5px; float: left;"><?php echo $data['toys']; ?></div></FONT></a></li></div></label>
   <?php }
}
?>
   </ul>
</div>
Merci à tous d'avance pour votre aide