Possible Duplicate:
highlighting search results in php/mysql
I am doing a search with a query, in MSSQL, like this:
SELECT ctext FROM Table WHERE ctext like '%filter%'
Then, I am wanting to highlight the hits with php:
function highlightme($str, $filter){
$html = "<FONT style=".chr(34)."BACKGROUND-COLOR: yellow".
chr(34).">".$filter."</FONT></P>";
$buf = str_replace($filter,$html,$str);
return $buf;
}
But, if the filter was 'Hello', and ctext contains 'hello', the SQL brings it, but php does not highlight it (I think it has to do with case sensitive) And, If the filter was, 'hellos' and ctext contains 'hello', the SQL brings it, but php does not hightlight it either.
How can I solve this two things??