Search specific keyword MySQL
What's the b开发者_StackOverflow中文版est way to find a specific keyword?
I combine php and the mysql LIKE '%xxxxx%' function to search articles. When I try to search a keyword for example 'HP' I get al the results containing this keyword, so an article whichs has 'PHP' in it also appears.
What's the best way to avoid this or does anybody have a workaround, method for this? I've tried al the other MySQL operators but no luck so far. Through REGEXP my search results were getting much better but I got still things in it that didn't belong there.
mySQL fulltext search may be for you, however that has some limitations too - most importantly, a 3-character minimum for keywords. So you couldn't search for "HP" without changing mySQL's server configuration to lower the minimum.
精彩评论