Quote:
Originally Posted by eblivion
How do I query the database using LIKE for an array but getting only results containing the full words instead of parts of it.
Here's a little chunk of what I have so far:
$keywords = explode(' ',$searchterm) ;
for ($i = 0; $i < sizeof($keywords); $i++){
$sql5b .= "description LIKE '%{$keywords[$i]}%'";
}
I have the query working, the problem is if one of the keywords is "class", the query will return results for: class, classic, midclass, classify, etc....
What I want to know is how to do the query where it will only return results for the word class and not other words containing it.
|
Hummm... Maybe adding white spaces around the keyword?
... WHERE description LIKE '% class %'