Re: PHP/MySQL question
| From: | Wolf | Date: | Mon, 05 Jun 2006 17:54:21 +0000 |
| Subject: | Re: PHP/MySQL question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237423@lists.php.net to get a copy of this message | ||
Thanks guys, I knew it was a stupid Q when I sent it, but I had another
one where I encapsulated them in () blow up on me, so I figured if I
asked and it was the same answer then I was on the right track.
And so far all the tests have shown positive. :)
Wolf
> More of a MySQL question, but easily enough answered;
>
> Always group the OR with parenthese and the AND individually. Write the
> query and test with MySQL before placing into PHP code;
>
> SELECT * FROM
table
> WHERE (foo = 'bar'
> OR foo = 'glorp'
> OR sqirk = 'glorp')
> AND today = CURDATE()
> AND userID = 'Marvin'
>