If you want to search for multiple values in a single field, a simple method is to use regular expressions. Note, this is not the most efficient method, but it does work.
For example, if I wanted to search for both "test" and "example" in a field I could do:
-
SELECT `stuff` FROM `myTable`
-
WHERE `myCol` REGEXP '[[:<:]](test|example)[[:>:]]';
-
This would return any field that had those two words anywhere within. The "[[:<:]]" and "[[:>:]]" parts will prevent it from matching the words within other words. If you don't want that, simply remove them.
(See
11.5.2. Regular Expressions for more info on how to construct more complex regular expressions)
If your search queries are coming in as space separated keywords, then all you would have to do is replace the space with a (|) and you put it into the query. The
str_replace function could help you with that.
P.S.
Be sure to
secure the input before using it though!