SV: MultSelect ListBox hell!

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

 



 


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 

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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux