My solution was almost as elegent...
$query="select * from customers";
$queryand=false;
if(!empty($f_Account)) {
$query.=" WHERE upper(P.Account) like upper('$f_Account')";
$queryand=true;
}
if(!empty($f_First_Name)) {
$query.=($queryand?" AND ":" WHERE ")."upper(p.First_Name) like
upper('$f_First_Name')";
$queryand=true;
}
...
For searchs, case doesn't matter (in my example), but you do need to index
your table accordingly for best results.
Also note upper() is the oracle uppercase function. I believe the uppercase
function varies from one RDBMS to another.
"Victor Foitzik" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello JD,
> on 19.04.2001 you wrote:
>
> > if (!empty($Price))
> > {
> > if(empty($whereclause))
> > {
> > $whereclause.="Price$Price";
> > }
> > else
> > {
> > $whereclause.=" AND 'Price $Price";
> > }
> > }
>
> and even better would be:
>
> if (!empty($$varname)) {
> $whereclause .= ($whereclause ? ' AND ' : '').
> "$varname =" . $$varname;
> }
>
> or something like this ;-)
>
> HTH
> Vic
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]