|
Posted by "Satyam" on 10/11/34 11:25
"Jim Moseby" <JMoseby@nrbindustries.com> wrote in message
news:FEE5CF83F4D3D511860100B0D02204BBD08903@NRBEXCHANGE-NT...
>>
>> 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";
>>
>> }
// This, if there was anything, would be executed if the date and the time
condition is true and the field is false
>> }
// this would be executed if the date condition is true and the time is
false, regardless of what the field condition is
>> }
>>
>> else {
>>
// this would be executed only if the date condition is false, regardless of
the other conditions
>> echo "<td class=\"tabletextred\">Failed";
>> }
>> </td>
>>
So, you better put all the conditions in a single if, joined by 'and' or &&:
if ($row['date'] < '2005-10-02' && $row['time'] < '12:00' && $row['field']
== 'P5' ) {
That would do what you want
Navigation:
[Reply to this message]
|