View Full Version : How can I search multiple fields for a LIKE %phrase%

10-29-2011, 10:14 AM
I have over 30 fields in my table and wish to find out how I allow my search page to perform a search all on fields nistead of having a very long query with each and every field in it.

Can this be done? if so how ?

10-29-2011, 11:25 AM
Consider adding a combined fulltext index on all the columns instead of using LIKE. See http://devzone.zend.com/article/1304 to know more

10-29-2011, 03:47 PM
Actually searching your table with LIKE '%searchterm%' is the worst way you can search your table. Any search beginning with the wild card % means that a table scan will be used and no index can be used to speed up your query.