in reply to Re: Re: mysql search statement
in thread mysql search statement
So, if $username is not populated (or otherwise false), but password is, you'll get:
$SQL = "SELECT FROM table WHERE AND password='pwd'
Just join your WHERE clauses together using the string, ' AND ' as the separator.
my @WHERE = (); push @WHERE, "username = '$username'" if $username; push @WHERE, "password = '$password'" if $password; push @WHERE, "name = '$name'" if $name; $SQL = "SELECT FROM table WHERE " . join ' AND ', @WHERE;
Or see my post at 'Re: (2): mysql search statement'.
dmm
You can give a man a fish and feed him for a day ...
|
|---|