</head>

<body>
<?
include("tamu_postdb.php");
if(empty($action))
{
if (empty($order)) $order =  2;
if (empty($page))  $page  =  1;
if (empty($hits))  $hits  = 100;
$start = $hits*($page-1);
$query = "SELECT * FROM $mytable";
$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 TAMU DIURUTKAN PALING AKHIR <strong>$xnum</strong> | ";
for ($i=1;$i<=$stw2;$i++) {if($page==$i){
echo "Halaman <b>$i</b> ";} 
else{echo " <font size=\"2\"><a href=\"?id=$id1&page=$i\">$i</A></font> ";}}
print ('<br><br>');
$query  = "SELECT * FROM ".$mytable." ";
if(!empty($squery)) { $query .= "WHERE tamu_id LIKE \"%$squery%\" ";}
$query .= "ORDER BY tamu_id DESC LIMIT $start,$hits";
$res = mysql_query($query);
print ('<table id="myTable" width="100%"  border="0" cellspacing="2" cellpadding="2">
        <thead><tr>
<td width="5%"><strong>NO</strong></td>
<td width="15%"><strong>Foto</strong></td>
<td width="70%"><strong>Nama Tamu</strong></td>
<td width="10%"><strong>DEL</strong></td>


</tr></thead><tbody>');
 $x=0;
  while($row = mysql_fetch_array($res))
  {
   $x++;
   if($x==2) {$barva = "FFFFFF";$x=0;} else {$barva = "FFFFD9";$x=1;}


print ('<tr bgcolor=#'.$barva.'>');
print ('<td><center>'.$row['tamu_id'].'</center></td>');
print ('<td><img src="../tamu/'.$row['tamu_foto'].'" width="160" height="63"></td>');
print ('<td>'.$row['tamu_nama'].' Alamat '.$row['tamu_alamat'].' Ket: '.$row['tamu_ket'].' Visited. '.$row['tamu_tgl'].'</td>');
print ('<td><center><a href="?g=bukutamudel&i=index&id='.$row['tamu_id'].'&file='.$row['tamu_foto'].'" class="menubin">HAPUS</a></center></td>');
print ('</tr>');
}
print ('</tbody></table>');
}
?>
