Say I have the current query:
SELECT * FROM `table` WHERE `name` IN ('spy', 'next', 'door')
That searches to see if there is a field with the name spy, the name next, or the name door right?
I want to see if there is any names CONTAINING the words: spy, next and door.
For example: Private Spy - the word spy would come up with that.
For example: Next Home - the word next would come up with that.
For example: The Door Mat - the word door would come up with that.
If there is a result called Spy Next Door, it only comes up with 1 result.
Help please? Is it possible what I'm asking? :x
WHERE name LIKE '%spy%'
OR name LIKE '%next%'
OR name LIKE '%door%'
Don't understand your mean?
I know LIKE works for that, but my script won't work like that, isn't there another way?
The 'where clause' by r937 does exatly what you asked for, unless I am missing something.
I was aiming to use IN and just use what I had coded as posted recently on the topic above.
But now it searches for the exact word entered, not a LIKE %$str% query like I am looking for, so I'm going to have to redo it.
yes, get a new script
With your sample on the other thread if you use $str - you can do the following
$whereclause = "where name LIKE '%".implode("%' OR name LIKE '%",str_word_count($str,1,'1234567890'))."%'";