Hello Everyone,
Hope your 2013 is treating you well.
Quick question and apologies if it is a stupid question.
Is this a viable syntax?
$sql = "SELECT orderid
FROM ORDERS_TABLE
WHERE orderstatus = 'Cancelled' OR (orderstatus = ('New' OR
'Denied' OR 'Expired' OR 'Failed' OR 'Pending' OR 'Refunded' OR
'Reversed' OR 'Under Review' OR 'Voided') AND orderdate <
'".mysqli_real_escape_string($yesterday)."')";
Namely the orderstatus = (a whole bunch of options).
In my database `orderstatus` field is an enum() list btw.
Or is there a better way to check multiple options against an enum
inside your select statement?
Reason I am doing this is to avoid having to do...
$sql = "SELECT orderid
FROM ORDERS_TABLE
WHERE orderstatus = 'Cancelled' OR (orderstatus = 'New' AND
orderdate < '".mysqli_real_escape_string($yesterday)."') OR
(orderstatus = 'Denied' AND orderdate <
'".mysqli_real_escape_string($yesterday)."') OR (orderstatus =
'Expired' AND orderdate <
'".mysqli_real_escape_string($yesterday)."') ... etc";
TIA,
Karl DeSaulniers
Design Drumm
http://designdrumm.com