I have a PHP search script and I want to highlight the keywords that the user has searched with tags. How can I do this?
My code is:
if(!empty($_GET[ q ])){
$keywords=explode( ,$_GET[ q ]);
foreach($keywords as $query){
$query=mysql_real_escape_string($query);
$likes[]="keywords LIKE %{$query}% ";
}
$searchResult=mysql_query("select * from questions where ".implode( or ,$likes)."limit 1");
while($row=mysql_fetch_assoc($searchResult)){
$results="<div class= webresult >{$row[ result ]}</div>";
}
}