Re: [PHP] Another question - not exactly what i was looking for

2002-01-15 Thread mike cullerton
how 'bout something like $query = 'select * from table_name where '; $and = ''; if ($lastname != '') { $query .= lastname = $lastname; $and = ' and '; } if ($firstname != '') { $query .= $comma.firstname = $firstname; $and = ' and '; } and so on on 1/15/02 1:53 PM, Phil Schwarzmann at

Re: [PHP] Another question - not exactly what i was looking for

2002-01-15 Thread R'twick Niceorgaw
construct your query like $query = select * from table where ; lastname='$lastname' and firstname='$firstname' and age='$age' and weight='$weight'; if (isset($lastname) and $lastname !=) then $query.= lastname=$lastname ; if (isset($firstname) and $firstname !=) then $query.= and

Re: [PHP] Another question - not exactly what i was looking for

2002-01-15 Thread Christopher William Wesley
$where_conditions = array(); if( !empty( $lastname ) ){ $where_conditions[] = lastname like '%${lastname}%'; } if( !empty( $firstname ) ){ $where_conditions[] = firstname like '%${firstname}%'; } if( !empty( $age ) ){ $where_conditions[] = age = ${age}; } if( !empty(