SV: [PHP-DB] MultSelect ListBox hell!

From: Date: Thu, 23 Sep 2004 12:54:00 +0000
Subject: SV: [PHP-DB] MultSelect ListBox hell!
Groups: php.db 
Request: Send a blank email to php-db+get-36353@lists.php.net to get a copy of this message
On 22 September 2004 18:45, Stuart Felenstein wrote: Given the conditions you want your WHERE phrase to test, you're going to need more parentheses to force the ORs to be evaluated before the ANDs; this is where the IN syntax, IMO, is more readable. So you want either: $sql .= "(state='".implode("' OR state='",$_POST['state'])."')"; or: $sql .= "state IN ('".implode("','",$_POST['state'])."')"; I agree, the IN syntax is more readable. But if the field is indexed, the OR syntax is faster, though not noticeably so in small tables. Regards Henrik Hornemann

« previous php.db (#36353) next »