I have list of items (separated by comma) that I need to look up in a database. Initially I was looking up each item code individually, but there must be an easier way of doing it.
I was playing around in phpMyAdmin trying to select items with no luck.
SELECT *
FROM `items`
WHERE `code` = ( 20298622
OR 83843296
OR 46549947 )
Returned no results.
SELECT *
FROM `items`
WHERE `code` =20298622
OR 83843296
OR 46549947
Returned every item in the database.
I was reading up on the MySQL docs, and it appears that OR (or ||) should do what I'm looking for. Where did I go wrong?
Also, FWIW, code is a integer field.
Thanks!