In that case you can do something like this:
$s_where = '';
foreach (array('name', 'lastname', 'nickname') as $e)
{
$s_where .= (!empty($s_where) ? ' AND ' : '' ) . (!empty($_REQUEST[$e]) ?
"$e='$_REQUEST[$e]'" : '' );
}
$result = mysql_query("SELECT id, name , lastname , m_date from users " .
hi.. your should just use if (empty($foo)) statements.. i did my search
scripts like that too and they were wonderful!
PS: besides $query, all the $variables are being posted from a form...
$query = "select * from myTable where ";
$query .= (!empty($typeS)) ? "Column1 =
r script
(that generates the sql statement) regarding how many form fields you
have every time you add a new form field to the form page.
Gav
-Original Message-
From: nabil [mailto:[EMAIL PROTECTED]
Sent: Thursday, 27 May 2004 10:57 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Multi s
yes, this is true, we should add empty() function too.
"Ross Honniball" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm not 100% sure, but you may want to also check if the field is empty
> (using empty() function) before including in your search. (in addition to
> isset)
>
> Als
I'm not 100% sure, but you may want to also check if the field is empty
(using empty() function) before including in your search. (in addition to
isset)
Also, just a caution, you will need to take some care in figuring when and
where to place your 'and' statements linking the various parts of t
Nabil wrote:
> "David Robley" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Nabil wrote:
>>
>> > hi all
>> >
>> > Is there a way to condition your search:
>> >
>> > -I have a form for four text boxes for search my Mysql...
>> > -I don't want to write 4 conditions and for SQ
thanks .. but my question is not for isset... i m thinking consider that i
have 10 search fields... if i have to do a combination then i need a day to
right the various SQL statements
"David Robley" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Nabil wrote:
>
> > hi all
> >
Nabil wrote:
> hi all
>
> Is there a way to condition your search:
>
> -I have a form for four text boxes for search my Mysql...
> -I don't want to write 4 conditions and for SQL statements incase he
> decided not to search with all keywords (fields)
> - I have by example : name, lastname ,