Danya,
<?
echo '<div class="subhead"><table width="100%" border="1">';
$query = mysql_query("SELECT * FROM `kost` ORDER BY `id` DESC"

;
$i=0;
while($row=mysql_fetch_array($query)){
++$i;
if ($i%4 == 1) echo '<tr>';
echo '<td>'.$row['img'].'</td>';
if ($i%4 == 0) echo '</tr>';
}
echo '</table></div>';
?>