Can I use "OR" in a mysql statement to check a fields value against multiple options?
//THE QUESTION IF HAVE IS HOW DO I DO SOMETHING LIKE BELOW MAINLY THE "1 OR 2 OR 3 OR 4" PART.
$sql = "SELECT email FROM USER_INFO WHERE storeID = '$storeNUM' AND region = '1 OR 2 OR 3 OR 4'";
$results2 = $db->query($sql);
You can use IN as a shorthand for multiple OR tests.
SELECT email
FROM USER_INFO
WHERE storeID = '$storeNUM'
AND region IN (1,2,3,4);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With