MySQL/PHP Search for multiple LIKE keywords
I've got a php array which can contain any amount of keywords and I want to do a LIKE search for these keywords accross multiple columns in my MySQL table.
Assuming $handler contains the keywords in a string that outputs like - 'keyword1', 'keyword2', 'keyword3' - I've tried the following
PHP Code:
$query_product = sprintf("SELECT * FROM products
WHERE prodCategory IN (%1\$s)
OR prodBrand IN (%1\$s)
OR prodName IN (%1\$s)
OR prodDescription IN (%1\$s)
OR prodPromoText IN (%1\$s)
ORDER BY prodPrice ASC",
$handler);
This searches each column but returns results that = keywords rather than results that are LIKE keywords.
Can I do something similar to the above with a LIKE search?
|