[PHP-DB] Re: [PHP] Any good way ?

2001-01-19 Thread TV Karthick Kumar

Hi

Thanks for your mail. But this is okay if I have only one variable, in
this case as per the manual it is: $i , but what'll happen if I have more
than two, and now I have three variables in my form to be checked and can it
be done in the Switch method ?. If yes, then pls. tell me how.

Pls. help me. Thanks in advance.

~ Karthick

> maybe I'm over simplifying... my apologies if I am but it looks like
you're
> testing each variable as a boolean value i.e. if(TRUE) so why not use a
> switch/case statement... easier to write and saved on extraneous curly
> syntax... look here
>
> http://www.php.net/manual/en/control-structures.switch.php
>
>
>
> -Original Message-
> From: TV Karthick Kumar [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 10:40 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP] Any good way ?
>
>
> Hi all
>
> I have written the following code, but I dont' think it's a good way
to
> write like this. Is there some other way to do good programming for this
?!
>
>

> **
>if ($f)
>{
> $SQL .= " (FIRST_NAME like '%$f%') AND ";
>}
>if ($l)
>{
> $SQL .= " (LAST_NAME like '%$l%') AND ";
>}
>if ($em)
>{
> $SQL .= " (HOME_EMAIL1 like '%$em%') OR (HOME_EMAIL2 like '%$em%') OR
> (WORK_EMAIL1 like '%$em%') OR (WORK_EMAIL2 like '%$em%') ";
>}
>

> **
>
> Any help is appreciated very much.
>
> Thanks in adv.
>
> ~ Karthick
>
>
>
> --
> PHP General 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 General 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]




[PHP-DB] RE: [PHP] Any good way ?

2001-01-19 Thread Matthew Ling

maybe I'm over simplifying... my apologies if I am but it looks like you're
testing each variable as a boolean value i.e. if(TRUE) so why not use a
switch/case statement... easier to write and saved on extraneous curly
syntax... look here

http://www.php.net/manual/en/control-structures.switch.php



-Original Message-
From: TV Karthick Kumar [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 10:40 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Any good way ?


Hi all

I have written the following code, but I dont' think it's a good way to
write like this. Is there some other way to do good programming for this ?!


**
   if ($f)
   {
$SQL .= " (FIRST_NAME like '%$f%') AND ";
   }
   if ($l)
   {
$SQL .= " (LAST_NAME like '%$l%') AND ";
   }
   if ($em)
   {
$SQL .= " (HOME_EMAIL1 like '%$em%') OR (HOME_EMAIL2 like '%$em%') OR
(WORK_EMAIL1 like '%$em%') OR (WORK_EMAIL2 like '%$em%') ";
   }

**

Any help is appreciated very much.

Thanks in adv.

~ Karthick



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