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

10-29-2011, 11: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, 12:25 PM
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, 04: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.