Re: [SPAM] - [PHP] Nested IFs Problem - Bayesian Filter detected spam

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

 



Justin & Jordan,

Thanks. The && was what I needed.

Albert Padley


On Aug 31, 2005, at 2:27 PM, Justin Francis wrote:

Albert Padley wrote:


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.


Once the first if statement is evaluated as true, the else statement will never be executed -- regardless of the outcome of the two nested ifs. I am not sure what you are trying to accomplish here, but perhaps all three of your if conditions should be combined into one if condition ANDed (&&) together? Or maybe the if...elseif...else structure is what you need.

Hope this helps.

Justin




I know it's something simple, but I just can't see it at the moment.

TIA

Albert Padley







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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