Qu'est-ce que tu affiches exactement dans ton résultat ?
Ce sont les champs code, nom...etc ?
Voici tout mon code
<?
// SÉLECTION RECHERCHE PAR MOTS CLEFS //
if(isset($_POST['rechercher'])) // POST RECHERCHER
{
$afficher1 = 1;
$showimg = $_POST['showimg'];
$showinfo = $_POST['showinfo'];
$order = $_POST['order'];
$keywords = $_POST["recherche"];
$sql = "SELECT description.code, description.nom, description.nomfr, description.genre, description.description, description.video, loan.loanto, loan.date_out, loan.date_in
FROM loan RIGHT JOIN description
ON description.code=loan.code
WHERE description.code LIKE '%".$keywords."%' OR
description.nom LIKE '%".$keywords."%' OR
description.nomfr LIKE '%".$keywords."%' OR
loan.loanto LIKE '%".$keywords."%'
ORDER BY ".$order."";
$resultat = mysql_query($sql);
} // IF RECHERCHER
else {}
if($afficher1 == 1)
{ ?>
<tr class="onglet">
<td class="dvd-image"></td>
<td class="dvd-code">CODE</td>
<td class="dvd-titre">TITRE</td>
<td class="dvd-genre">GENRE</td>
<td class="dvd-loan">LOUER À</td>
</tr>
<span class="recherche">the</span>
<?
}
if (mysql_num_rows($resultat) >= 1)
while ($rows=mysql_fetch_array($resultat))
{
?>
<tr class="resultat">
<td class="image"> <? if ($showimg=="oui")
{
$image = (file_exists("thumb/".$rows['code'] ."_t.jpg")) ? "thumb/".$rows['code'] ."_t.jpg" : "thumb/defaut.jpg";
$b_image = (file_exists("thumb_b/b_".$rows['code'] .".jpg")) ? "thumb_b/b_".$rows['code'] .".jpg" : "thumb/defaut.jpg";?>
<A HREF="#" onClick="window.open('<? echo $b_image; ?>','_blank',' width=410, height=500');return(false)"><?echo('<img src="'.$image.'" border="0" >');?></a>
<? }?>
</td>
<td class="code"><? echo $rows['code']; ?></td>
<td class="titre"><b><a href="infodvd.php?code=<? echo $rows['code']; ?>"><? echo $rows['nom']; if ($rows['video']== true){?><a href="infodvd.php?code=<? echo $rows['code']; ?>#video"><img src="images/video.jpg" border="0" height="20"></a><?}?><br><div class="description"><b><? echo $rows['nomfr']; ?></b></div></a></b>
<? if ($showinfo=="oui")
{ ?>
<div class="description"><? echo $rows['description']; ?></div>
<? } ?>
</td>
<td class="genre"><? echo $rows['genre']; ?></td>
<td class="loan"><? if ($rows['loanto']==false)
{
echo '<img src="images/yes.jpg" border="0" width="18" height="16"> <br>Disponible</a>';
}
elseif ($rows['loanto']==true)
{
echo '<img src="images/no.png" border="0"> <br>Non Disponible</a>';
}
?></td>
</tr>
<? }
Il est pas super bien coder, mais il fonctionne, juste l'affaire de colorer le mot de recherche que je n'arrive pas.
La ligne:
$chaine_sortie = ereg_replace($mot_recherche, $mot_de_remplacement, $chaine);
n'y est pas, je l'ai essayer à plusieur place en modifiant les variable, mais ca ne fonctionnait pas,