What's wrong with this for loop?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
deafpanda
Forum Newbie
Posts: 7
Joined: Thu Jul 31, 2008 5:25 pm

What's wrong with this for loop?

Post 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;?>
   
deafpanda
Forum Newbie
Posts: 7
Joined: Thu Jul 31, 2008 5:25 pm

Re: What's wrong with this for loop?

Post 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 :)
Post Reply