note 43814 added to function.implode

From: Date: Mon, 05 Jul 2004 05:27:23 +0000
Subject: note 43814 added to function.implode
Groups: php.notes 
Request: Send a blank email to php-notes+get-72555@lists.php.net to get a copy of this message
Just a small thing to refine this example, I usually construct my queries something like this: <? $count = count( $state ); $qry="SELECT * FROM currentOrders WHERE date>=$from AND date<=$to"; if($count > 1){ $states = implode( "'.'", $state ); $qry.=" AND state IN ('$states')"; } else if($count==1){ $qry.=" AND state = ('$states[0]')"; } ?> Also if there is no 'where' statement without a selection I just put, where 1=1 for an 'and' and 1=2 for and 'or' ---- Manual Page -- http://www.php.net/manual/en/function.implode.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43814 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43814&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43814&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#72555) next »