Re: Highlighting found search words
| From: | John Nichel | Date: | Tue, 04 May 2004 13:50:02 +0000 |
| Subject: | Re: Highlighting found search words | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185307@lists.php.net to get a copy of this message | ||
Dave Carrera wrote:
Hi List, I have my db which I search for words and that works ok. What I would like to do is from the results, highlight each word in the string use in the query. So if the returned string is. The quick brown fox jumped of the And my search was "quick fox" Then in the returned results "quick fox" would be highlighted where ever either word occurs in the string. I am having major probs with this so any help or advice is very much appreciated. Thank you in advance for any help Dave C$highlighted = preg_replace ( "/$search_term/i", "<b>$search_term</b>", $data ); -- John C. Nichel KegWorks.com 716.856.9675 john@kegworks.com