par
virginie » 17 mai 2010, 21:51
Bonjour, après plusieurs tentatives avec echec sur la coloration du resultat de de ma requete sql je tente un help.
J'ai testé str_replace sous differente forme même avec le manuel
http://php.net/manual/fr/function.str-replace.php
rien a faire je n'arrive pas a coloriser le mot que j'ai placé dans ma recherche. Peut être que ce n'est pas possible avec le WHILE si qu'un sait merci de m'aider.
On ma aiguillé avec cette fonction
str_replace('velo', '<span style="color:#ff8888">velo</span>');
mais je n'arrive pas à le faire fonctionner avec la variable
$sql = mysql_db_query($sql_bdd,"SELECT * FROM annonce WHERE MATCH (titre,description) AGAINST ('+$recherche' IN BOOLEAN MODE) ORDER BY id DESC LIMIT ". $_GET['debut'] .",". $nb_affichage_par_page ." ;",$db_link) or die(mysql_error());
while ($data = mysql_fetch_array($sql))
{
echo '
<table width="680" bgcolor="#FFFFCC" cellspacing="0" cellpading="0">
<tr>
<td valign="top" width="560" bgcolor="#000000">
<font size="2" color="#FFFFFF">
' , stripslashes(htmlentities(trim($data['titre']))) , '
' , stripslashes(htmlentities(trim($data['description']))) , '
</font>
</td>
</tr>
</table>';
}
}
mysql_free_result ($sql);
merci a vous
Bonjour, après plusieurs tentatives avec echec sur la coloration du resultat de de ma requete sql je tente un help.
J'ai testé str_replace sous differente forme même avec le manuel http://php.net/manual/fr/function.str-replace.php
rien a faire je n'arrive pas a coloriser le mot que j'ai placé dans ma recherche. Peut être que ce n'est pas possible avec le WHILE si qu'un sait merci de m'aider.
On ma aiguillé avec cette fonction
[php]
str_replace('velo', '<span style="color:#ff8888">velo</span>');
[/php]
mais je n'arrive pas à le faire fonctionner avec la variable
[php]
$sql = mysql_db_query($sql_bdd,"SELECT * FROM annonce WHERE MATCH (titre,description) AGAINST ('+$recherche' IN BOOLEAN MODE) ORDER BY id DESC LIMIT ". $_GET['debut'] .",". $nb_affichage_par_page ." ;",$db_link) or die(mysql_error());
while ($data = mysql_fetch_array($sql))
{
echo '
<table width="680" bgcolor="#FFFFCC" cellspacing="0" cellpading="0">
<tr>
<td valign="top" width="560" bgcolor="#000000">
<font size="2" color="#FFFFFF">
' , stripslashes(htmlentities(trim($data['titre']))) , '
' , stripslashes(htmlentities(trim($data['description']))) , '
</font>
</td>
</tr>
</table>';
}
}
mysql_free_result ($sql);
[/php]
merci a vous