safetybrick safetybrick - 1 year ago 64
PHP Question

How do i display the output of a "while loop" in a table?

I don't even have an idea of where to start for this. I need to display 100 numbers in a table and would like to use a while loop to do so. is there a "shortcut" to doing this?

Answer Source

For a table you need some tags table, tr and td. The tr and td are in while loop and the value $i will print inside the td.

    $i = 1;
    while($i != 101){?>
    <tr><td><?php echo $i++;?></td></tr>
    <?php }?>   
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download