note 43814 deleted from function.implode by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 05 Jul 2004 06:56:58 +0000 |
| Subject: | note 43814 deleted from function.implode by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72560@lists.php.net to get a copy of this message | ||
Note Submitter: phpguru@gmail.com
----
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'