Re: PHP/MySQL question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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'
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux