<?php
$hs = mysql_query("select * from nama_tabel");
$perbaris = 4;
echo '<table border="1">';
$i =0;
$jmlData = mysql_num_rows($hs);
while($data = mysql_fetch_array($hs)){
if($i++ % $perbaris == 0){
echo '<tr>'
}
echo '<td>';
print_r($data);
echo '<td>';
if($i % $perbaris == 0 || $i == $jmlData){
echo '</tr>';
}
}
echo '</table>';