Re: nested statement problem
| From: | Torsten Roehr | Date: | Fri, 11 Jun 2004 17:43:37 +0000 |
| Subject: | Re: nested statement problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-188121@lists.php.net to get a copy of this message | ||
"Eric Boerner" <eric@mojavedata.gov> wrote in message
news:001301c44fd9$6b803b80$aa01a8c0@Webmaster...
> I am having a problem with a nested if statement in php. Everything
> works fine, but it doesn't display the information that I am trying to
> retrieve using a second if statement.
>
> CODE:
>
> if (($fr == 'FR') && ($xe == 'XE') && ($co ==
> 'CO')) { print
> "Statement";
> } elseif (($ag == 'AG') && ($rz == 'RZ') && ($sa ==
> 'SA')) {
> print "Additional Statement";
> if ($sr == 'SR') { print "More Info"; }
> print "Line continuation";
> if (($rx == 'RX') && ($rj == 'RJ') && ($rr ==
> 'RR') &&
> ($rd == 'RD') && ($ra == 'RA')) { print "additional
> information"; }
>
> // Everything works except this nested if statement - No php error, it
> just doesn't display the information
>
> print "</font></td></tr><tr>";
> } else { print "other information if false"; }
If it doesn't execute your code then the if statement doES NOT evaluate to
true. Have you printed out the values and manually checked them?
By the way, you don't need braces around each condition:
if (($fr == 'FR') && ($xe == 'XE') && ($co == 'CO'))
{}
works also as:
if ($fr == 'FR' && $xe == 'XE' && $co == 'CO') {}
Regards,
Torsten Roehr