View Full Version : highlight search terms after PHP search

12-20-2010, 11:55 PM
Can anyone offer me some information on how forums like these highlight the search terms after a search is done? and how the search is done?

Is there a shortcut method or useful tool in PHP other than scanning a database by searching every field for search terms?

Or is it as simple as:
$q = select * from db where field LIKE '*' . searchterms . '*';

I'm curious. I would like to list many articles and functions on my site, but I want to offer a search page as well, that will search an entire database for records that contain the search terms, regardless of what field they are in. Is that an easy thing to do?


12-21-2010, 04:03 AM
If you're using MySQL you can use a FULLTEXT Index.