<br>每隔4个结果来自sql

Simple question of course But I still could not figure it till now :) Im pulling names out of an sql and I want to be like 1 2 3 4,then next Line like 5, 6, 7, 8 Like So

<a>Bob</a>, <a>John</a>, <a>Bob</a>, <a>John</a> <BR>
<a>Bob</a>, <a>Ion</a>, <a>Bob</a>, <a>Pon</a> <BR>

Well thats What I want it To look like But For Now Its One Row Endless with no spaces is what I acheved so far Like So :)

<?PHP
require('connect.php');
$sql="SELECT  * FROM profile";
  $result=mysql_query($sql);
  while($row=mysql_fetch_array($result)){
        $name =$row['username'];
        $power =$row['power'];
?>
<a href="user.php?id=<?PHP echo $name; ?>"><span class='user-group-<?PHP echo $power; ?>'><?PHP echo $name; ?></span> </a>,


<?PHP } ?>  

Now What Do I need to do to have every forth result + that
space :?

Use an $i counter:

    require('connect.php');
    $sql    =   "select * from profile";
    $result =   mysql_query($sql);

    // Start at 1
    $i = 1;
    while($row = mysql_fetch_array($result)){
        $name   =   $row['username'];
        $power  =   $row['power']; ?>
<a href="user.php?id=<?PHP echo $name; ?>"><span class='user-group-<?php echo $power; ?>'><?PHP echo $name; ?></span> </a>
     <?php  
            // When hit 4, add <br />
            if($i == 4) {
                    echo '<br />';
                    // Reset to 0. $i will then auto-increment
                    // to 1 when hits $i++
                    $i = 0;
                }
            else
                // Add comma if not equal to 4.
                echo ',';
            $i++;
        }