Small sample to be used with mysql_fetch_assoc:
code:
<?
$cols = 4;
$now = 0;
echo '<table><tr>';
while($d = mysql_fetch_assoc($sql_query)) {
echo '<td>'.$d['column1'].'</td>';
$now++;
if($now == $cols) {
echo '</tr><tr>';
$now = 0;
}
}
echo '</tr></table>';
?>