Page 1 of 1

What's wrong with this for loop?

Posted: Thu Jan 08, 2009 8:07 am
by deafpanda
Hi there, can anyone help me with this bit of code?

The loop below should display data from three entries in the "task" table. Instead, it displays nothing. To debug, I tried to echo $b. Again, nothing?!

Echoing $summary['Task'][0]['due_date'] works as expected, by the way.

Why is nothing being displayed?

Thanks

Code: Select all

 
<?php for ($b=0; $b>=2; $b++):?>
    <?php echo $b;?>
    <table class="taskTable">
        <tr>
            <th>Deadline:</th><td <?php echo $taskClass . '>' . $time->format('d-m-Y',$summary['Task'][$b]['due_date']); ?></td>
        </tr>
        <tr>
            <th>Owner:</th>
            <td><?php echo $summary['Task'][$b]['task_owner'];?></td>
        </tr>
        <tr>
            <th>Task:</th>
            <td><?php echo $summary['Task'][$b]['task_description'];?></td>
    </table>
<?php endfor;?>
   

Re: What's wrong with this for loop?

Posted: Thu Jan 08, 2009 11:08 am
by deafpanda
Ooooooooooops...

Code: Select all

 
<?php
    for ($i=0;$i<=2;$i++){
    }
?>
 
That's 2 hours of my life that I'll never see again :)