Bonjour , je souhaite faire un script de recherche interne à mon site.
Voici mon code:
Code : PHP
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 <?php function recherche($mot_cles) { include ("connexion.php"); $mot_cles = $mot_cles; //on commence dans les photos !! Normal !!!! //on fera après pour les news $recherchetof = mysql_query('SELECT * FROM `photos` WHERE `titre` OR `motscles` OR `categorie` OR `commentaire` like "$mot_cles" ') ; while ($recherchephot = mysql_fetch_array($recherchetof) ) { echo $recherchephot['titre']; echo '<br />'; } } recherche('Angel'); ?>
Le problème est qu'il me sort trois resultats sur un même enregistrement car il trouve trois fois le mot angel dans un enregistrement.
Merci d'avance.
Partager