searching database >> highlighting result
at this moment I´m working on a search script. I want the searched strings to be highlighted in the output.
somebody enters the word monday in the searchfield. My script makes a database query and delivers the hole text: Meatless Monday prevents causes of heart disease, ...
I want the word monday e.g. with a yellow background or something.
I´m using while and mysql_fetch_object in my script.
Any ideas or sources?
Try str_replaceing the $word with like <span style="background-color: yellow">$word</span>
thanks, I forgot about that. Unfortunately str_ireplace (case-insensitive) is just PHP 5. So I´m now using eregi_replace too.