<?
mysql_connect("localhost", "root", "benk");
mysql_select_db("cma");
$bulan = $_GET["month"];
$page = $_GET["page"];
if(empty($action))
{
if (empty($order)) $order =  2;
if (empty($page))  $page  =  1;
if (empty($hits))  $hits  = 500;
$start = $hits*($page-1);
$query = "SELECT * FROM besuk_events WHERE event_month = '$bulan'";
$res = mysql_query("$query"); 
$xnum = mysql_num_rows($res);
$stw2 = (int)($xnum/$hits);
if ($xnum%$hits > 0) {$stw2++;}
$np = $page+1;
$pp = $page-1;
if ($page == 1) { $pp=1; }
if ($np > $stw2) { $np = $stw2;} 
echo "DAFTAR PEMOHON BESUK <strong>$xnum</strong> | ";
for ($i=1;$i<=$stw2;$i++) {if($page==$i){
echo "<b> HAL $i |</b> ";} 
else{echo "<a href=\"?g=daftartahanan&d=inc_op&page=$i\"> $i |</a>";}}
print ('<br><br>');
$query  = "SELECT * FROM besuk_events ";
if(!empty($squery)) { $query .= "LIKE \"%$squery%\" ";}
$query .= "WHERE event_month = '$bulan' ORDER BY event_id DESC LIMIT $start,$hits";
$res = mysql_query($query);
print ('<table id="myTable" width="100%"  border="0" cellspacing="1" cellpadding="1" bgcolor="#B05800">
        <thead><tr>
		<td width="3%"><span class="style1"><strong>NO</strong></span></td>
<td width="20%"><span class="style1"><strong>TIKET</strong></span></td>
<td width="77%"><span class="style1"><strong>IDENTITAS</strong></span></td>
<td width="10%"><span class="style1"><strong>DETAIL</strong></span></td>

</tr></thead>');
$no=1; // fungsi nomor
 $x=0;
  while($row = mysql_fetch_array($res))
  {
   $x++;
   if($x==2) {$barva = "FFFFB7";$x=0;} else {$barva = "FFD8B0";$x=1;}
print ('<tr bgcolor=#'.$barva.'><td><center>'.$no++.'<center></td><td><b>'.$row['event_tiket'] .'</b></td>');


print ('<td>'.$row['event_identitas'] .'</td>');

print ('<td>VIEW</td>');

print ('</tr>');
}
print ('</tbody></table>');
echo "<br><br>Ditampilkan $hits /Halaman";
}
//}
?>
