Hello JD,
on 19.04.2001 you wrote:

> I am building a query from a search form. This is the code I have now:

> if (!empty($whereclause))
>          {
>                 $whereclause=urldecode($whereclause);
>                  $whereclause=stripslashes($whereclause);
>          }

>          extract($HTTP_POST_VARS);

>                  if (!empty($Price))
>                  {
>                         if(empty($whereclause))

<--- blah blah blah --->

> It Just became apparent that I am going to need to add a whole bunch more
> search criteria.. Does anyone have any advice/suggestions for getting rid of
> all those if statements?

> JD

what about using a foreach statement and going through all the
variables you need like this ?

$myvars = array('Price', 'Stuff', 'Thing');
foreach ($myvars as $varname) {
        if (!empty($$varname)) {
           // do funky stuff here
        }
}

HTH
Victor



-- 
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]

Reply via email to