RE: [PHP] PHP/MySQL question

From: Date: Mon, 05 Jun 2006 15:42:03 +0000
Subject: RE: [PHP] PHP/MySQL question
Groups: php.general 
Request: Send a blank email to php-general+get-237406@lists.php.net to get a copy of this message
[snip] I need to do an OR search on three columns, and AND the rest, anyone have a good way to do this? So far my searching on the MySQL lists have been fruitless more then anything, and I figured we've probably come across this ourselves at some point. [/snip] 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'

« previous php.general (#237406) next »