Try this:
Code:
<table width="988" border="0" align="center" cellpadding="0" cellspacing="0" nowrap="nowrap">
<?php
$counter = 0;
$query = mysql_query("SELECT customavatar.filename, customavatar.userid, user.username, user.avatarrevision FROM customavatar LEFT JOIN user USING (userid) WHERE user.usergroupid = '10'");
while ($row = mysql_fetch_assoc($query))
{
if($counter == 6 OR $counter==0)
{
$counter = 0;
echo ' <tr><td align="center" nowrap="nowrap">';
echo '<a href="http://www.mysite.com/boards/'.$row['username'].'">';
echo '<img src="http://www.mysite.com/boards/customavatars/avatar'.$row['userid'].'_'.$row['avatarrevision'].'.gif">'; // Avatar image
echo '<br>';
echo '<center><a href="http://www.mysite.com/boards/'.$row['username'].'">'.$row['username'].'</a></center>'; // linked username
echo '</td></tr>';
}
else
{
echo ' <td align="center" nowrap="nowrap">';
echo '<a href="http://www.mysite.com/boards/'.$row['username'].'">';
echo '<img src="http://www.mysite.com/boards/customavatars/avatar'.$row['userid'].'_'.$row['avatarrevision'].'.gif">'; // Avatar image
echo '<br>';
echo '<center><a href="http://www.mysite.com/boards/'.$row['username'].'">'.$row['username'].'</a></center>'; // linked username
echo '</td>';
}
$counter++;
}
?>
</table>