The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How do I...MySQL %LIKE% query
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. |
#2
|
||||
|
||||
Quote:
... WHERE description LIKE '% class %' |
#3
|
|||
|
|||
Thanks. That's what I ended up doing....
The only drawback is if the word is at the beginning/end of the description and there's no white space before/after it. Since this may occur in only a few searches, it's adequate for now. ~ Thanks again ~ |
#4
|
||||
|
||||
You might also want to use mySQL fulltext searching.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|