Re: IF with multiple values for a variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Excellent!  Double pipes to seperate possible multiple variable values.
<lock in memory>

Thanks Daniel!


On 6/13/07, Daniel Brown <parasane@xxxxxxxxx> wrote:

On 6/13/07, Dan Shirah <mrsquash2@xxxxxxxxx> wrote:
> Okay, I know this has got to be easy but it's not working any way I try
it.
>
> When a record is selected it opens up a new page.  My query will display
the
> specific results based on the type of record selected.  There can be
> multiple values in each if.  However I am having a brain fart in my if
> statement assigning the multiple values.
>
> Here is my if statement:
>
>  if ($type == 'T','D','L' {
>     $get_id.=" payment_request WHERE id = '$payment_id'";
>     }
>
> However this does not return ant results.
> I've tried  if ($type = array('T','D','L'), if ($type ==
array('T','D','L'),
> if ($type == 'T,D,L'), if ($type == 'T' or 'D' or 'L'
>
> I also looked in the PHP manual for examples of if's and didn't find any
> help.
>
> I can get it to work if I create a seperate if statement for each type
> condition but i would prefer to not duplicate my code just to add a
seperate
> $type
>

   Dan,

   Are you trying to do this?

<?
   if ($type == 'T' || $type == 'D' || $type == 'L') {
       $get_id.=" payment_request WHERE id = '$payment_id'";
   }
?>

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux