I have a PHP array containing values and I want to query the database to find any results where the ItemName contains any of the values in the array.
$current_item = 'Big Fancy Red Car';
$words = explode(' ',$current_item); // Array of words to search
And the query:
SELECT ID FROM store_accessories WHERE ItemName LIKE '%$words%'
How do I select the ID of any items in the table whose ItemName contains any of the values in the $words array?
store_accessories? If possible, a FULLTEXT index is an ideal solution, available in MyISAM tables before MySQL 5.6, and InnoDB after.column LIKE %$word% OR...conditions. Considerably less efficient than a FULLTEXT index.