for loop not suitable?

Posted by Luke on Stack Overflow See other posts from Stack Overflow or by Luke
Published on 2010-05-29T11:25:12Z Indexed on 2010/05/29 11:32 UTC
Read the original article Hit count: 387

Filed under:

I have created a for loop. I am trying to loop through lots of members and create a row for each member in a table.

It's looping through too many times. Is it the right type of loop to use?

        <?php
    for ($i = 1; $i = count($u); $i++) 
    {
        ?>
        <tr>
                <?php
                    echo "<td>$i</td>";
                ?>

                <?php
                foreach ($u as $username)
                {
                    echo "<td>$username</td>";
                }
                ?>
                <?php
                foreach ($p as $points)
                {
                    echo "<td>$points</td>";
                }
                ?>
        </tr>
        <?
    }
    ?>

$u and $p are arrays.

Thanks

© Stack Overflow or respective owner

Related posts about php