Searching for multiple words.

wxdqz

New Member
I know this is probably a basic thing, but I can't seem to find info anywhere. I have a basic search script that can search multiple columns for one word or one string using:

select * from TABLE where (COLUMN1 like '%$word%' or COLUMN2 like '%$word%')

If $word is passed as more than one word, how can I get it to search both COLUMN1 and COLUMN2 for either of the passed words, as well as for both?

Example, if someone searches for "dog cat" I want it to retrieve all entries that have either "dog", "cat", or "dog" AND "cat" in them, in any order. Make sense?

Thanks in advance.
 
Back
Top