Greetings,
Let’s say I have the following mysql query to search for “Blue Widget”:
$sql = "SELECT * FROM items WHERE (title LIKE '%Blue%' OR description LIKE '%Blue%') OR (title LIKE '%Widget%' OR description LIKE '%Widget%');
This selects all the items with the word “Blue” and all the items with the word “Widget”. How can I give higher preference to items that contain both “Blue” and “Widget”?
For instance, how can I ORDER the query results so that items that matched 2 of the words get displayed higher than items that have matched only 1 of the words?
Thanks