$q=mysql_query("select * from table");
echo "<table cellpadding='5' width='100%'><tr>";
$i=0;
while ($g=mysql_fetch_array($q)) {
if($i!=0&&$i%3==0) { echo "</tr><tr>"; }
echo"<td>".$g["row"]."</td>";
$i++;
}

echo "</tr></table>";
dipnot: sorgunu buraya yazarsan daha kolay olurdu...