[PHP-DB] SQL syntax

2013-01-15 Thread Karl DeSaulniers
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'

Re: [PHP-DB] SQL syntax

2013-01-15 Thread Amit Tandon
SELECT orderid FROM ORDERS_TABLE WHERE orderstatus IN ( 'Cancelled', 'New', 'Denied', 'Expired' , 'Failed' , 'Pending' , 'Refunded' , 'Reversed' , 'Under Review' , 'Voided') AND orderdate '.mysqli_real_escape_string($ yesterday); Another option would be to use

[PHP-DB] Re: SQL syntax

2013-01-15 Thread David Robley
Karl DeSaulniers wrote: 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

Re: [PHP-DB] SQL syntax

2013-01-15 Thread Karl DeSaulniers
On Jan 15, 2013, at 5:25 AM, Amit Tandon wrote: SELECT orderid FROM ORDERS_TABLE WHERE orderstatus IN ( 'Cancelled', 'New', 'Denied', 'Expired' , 'Failed' , 'Pending' , 'Refunded' , 'Reversed' , 'Under Review' , 'Voided') AND orderdate

Re: [PHP-DB] Re: SQL syntax

2013-01-15 Thread Karl DeSaulniers
On Jan 15, 2013, at 5:31 AM, David Robley wrote: Karl DeSaulniers wrote: 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

Re: [PHP-DB] Re: SQL syntax

2013-01-15 Thread Bastien
Try It And See Bastien Koert On 2013-01-15, at 7:43 AM, Karl DeSaulniers k...@designdrumm.com wrote: On Jan 15, 2013, at 5:31 AM, David Robley wrote: Karl DeSaulniers wrote: Hello Everyone, Hope your 2013 is treating you well. Quick question and apologies if it is a stupid question.

Re: [PHP-DB] Re: SQL syntax

2013-01-15 Thread Karl DeSaulniers
True, I guess it never hurts to try. Busy making orders and hadn't tested just yet. I just wanted a professional opinion on if the syntax was common to use, mostly. Didn't want to get a Jr PHP job and use it and have everyone looking at me sideways.. :P Thanks all, Best, Karl On Jan 15,

[PHP-DB] PDO ?

2013-01-15 Thread Jim Giner
Doing some conversion - looking for a solution. Currently I do something like this: while (list($var1,$var2) = mysql_fetch_array($qrslts)) { handle the vars } Is there something in the PDO functions that emulates this same ability? Some of my uses of the sql syntax have many more vars

[PHP-DB] Re: SQL syntax

2013-01-15 Thread Frank Flynn
Or is there a better way to check multiple options against an enum inside your select statement? IN for example: orderstatus IN ( 'Cancelled', 'New', 'Denied', 'Expired') However this is not exactly what you are doing. You want different orderdate $yesterday depending on the orderstatus.

Re: [PHP-DB] PDO ?

2013-01-15 Thread KapuĀ®
On 15. 1. 2013 18:25, Jim Giner wrote: Doing some conversion - looking for a solution. Currently I do something like this: while (list($var1,$var2) = mysql_fetch_array($qrslts)) { handle the vars } Is there something in the PDO functions that emulates this same ability? Some of my uses

[PHP-DB] Re: PDO ?

2013-01-15 Thread Jim Giner
Never Mind A little careful re-reading of the docs told me what I was doing wrong. I always use PDO::FETCH_ASSOC in my fetch statements. Discovered that I have to have numerical array results in order to utilize the List command. Voila! -- PHP Database Mailing List