...

View Full Version : highlight search terms after PHP search



ajetrumpet
12-20-2010, 10: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?

thanks!

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

http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum