Re: PHP and MySQL ....dynamic query?
| From: | Richard Lynch | Date: | Sat, 10 Mar 2001 02:08:24 +0000 |
| Subject: | Re: PHP and MySQL ....dynamic query? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43274@lists.php.net to get a copy of this message | ||
>You can see my problem here. I want to be able to write parts of my sql
statement based upon >user input, and then execute it all at once. How do I
tie all of my $qual variables in so >that this will read/execute it
properly?
$where = ' where 1=1 ';
if ($dig == '1'){
$where .= " and track >= 0 ";
}
elseif ($dig == '2'){
$where .= " and track >= 0 ";
$where .= " and track <= 100 ";
}
if ($lot == '1'){
$where .= " and acres >= 100 ";
}
elseif ($lot == '2'){
$where .= " and acres >= 500 ";
$where .= " and acres <= 650 ";
}
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm