$bulan = array(
'01' => 'Jan',
'02' => 'Feb',
'03' => 'Mar',
'04' => 'Apr',
'05' => 'Mei',
'06' => 'Jun',
'07' => 'Jul',
'08' => 'Aug',
'09' => 'Sep',
'10' => 'Oct',
'11' => 'Nov',
'12' => 'Dec'
);
?>
<table>
<tr>
<td>Kabupaten</td>
<?php foreach ($bulan as $bln) { ?>
<td><?php echo $bln; ?></td>
<?php } ?>
</tr>
<?php
$sql = mysql_query("select * from tbl_lap group by kabupaten");
while ($data = mysql_fetch_query($sql)) {
?>
<tr>
<td><?php echo $data['kabupaten'] ?></td>
<?php
foreach ($bulan as $bln) {
$sqlbln = mysql_query("select count(kecamatan) as cnt from tbl_lap where month(tglmasuk)='$bln'");
$count = mysql_fetch_array($sqlbln);
?>
<td><?php echo $count['cnt'] ?></td>
<?php } ?>
</tr>
<?php } ?>
</table>