simplest method, replace the || with &&.
On 30/01/07, Mountain Man <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I did a search for "conditional statements" and "conditional
> statement" on Cake PHP and received 3 listings, none of which answers
> the following question. Thanks in advance to all who can help.
>
> I have a problem with a conditional statement and hope someone can
> offer some insight on it. The code with comments is shown below. I
> only want this code to be executed if the value of $own_files[0] is
> something other than "Yes" or "No." Unfortunately the code is executed
> when the array element holds these values.
>
> <?php
> 1 elseif(($own_files[0] != 'Yes') || ($own_files[0] != 'No')){
> 2 $state_array['own_files'] = 'false';
> 3 echo "From the function: $own_files[0]<br />";
> 4 // When the value of $own_files[0] on line 3 reads 'Yes' or 'No'
> this conditional
> 5 // code is executed. Do you see a problem with my conditional
> statement?
> 6 }
> ?>
>
> Cheers,
>
> Mountain Man
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---