I am trying to set up a search function on my site that will only return exact matches to the keyword entered by the user. Therefore, if a user searches for a “dog,” I don’t want an article called “Doggy Style” to appear in the search results (just an example, I really don't have an article with that name). This, of course, does just that:
SELECT * FROM articles WHERE article_title LIKE '%$searchQuery%'
$ searchQuery is a PHP variable taken from a user input form. So can only exact matches be returned?
source
share