RE: [PHP] Nested IFs Problem
| From: | Jim Moseby | Date: | Wed, 31 Aug 2005 20:26:49 +0000 |
| Subject: | RE: [PHP] Nested IFs Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-221666@lists.php.net to get a copy of this message | ||
>
> I have the following nested ifs:
>
> if ($row['date'] < '2005-10-02') {
> if ($row['time'] < '12:00') {
> if ($row['field'] == 'P5' ) {
>
> echo "<td class=\"tabletextbluebg\">Success";
>
> }
> }
> }
>
> else {
>
> echo "<td class=\"tabletextred\">Failed";
> }
> </td>
>
> Whenever the 3 if statements are true, I always get the correct
> "Success" to echo. However, if any or all of the if statements are
> false, I never get "Failed" to echo.
>
> I know it's something simple, but I just can't see it at the moment.
>
> TIA
>
> Albert Padley
Just shooting from the hip here, you will never get the "Failed" echo unless
the FIRST if is false.
JM