<table width="100%"  border="0" cellspacing="8" cellpadding="8">
  <tr>
    <td><?
include("../index.cma.db.php");
mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$query = "Select * from tab_dataperkara where t_id = '1'"; 
$result = mysql_query($query); 
if($row2 = mysql_fetch_array($result)){ 
$mytable = $row2['t_table'];
$edisi = $row2['t_tahun'];
$page2 = $_GET["page2"];
if(empty($action))
{
if (empty($order)) $order =  2;
if (empty($page2))  $page2  =  1;
if (empty($hits))  $hits  = 500;
$start = $hits*($page2-1);
$query = "SELECT * FROM $mytable WHERE p16_jaksa1 !='0' ORDER BY uid DESC";
$res = mysql_query("$query"); 
$xnum = mysql_num_rows($res);
$stw2 = (int)($xnum/$hits);
if ($xnum%$hits > 0) {$stw2++;}
$np = $page2+1;
$pp = $page2-1;
if ($page2 == 1) { $pp=1; }
if ($np > $stw2) { $np = $stw2;} 
echo "P21 | TOTAL PERKARA $edisi SEBANYAK <strong>$xnum</strong> TERSANGKA | ";
for ($i=1;$i<=$stw2;$i++) {if($page2==$i){
echo "<b> HAL $i |</b> ";} 
else{echo "<a href=\"?g=pratut&i=index&page2=$i#tab1\"> $i |</a>";}}
print ('<br><br>');
$query  = "SELECT * FROM $mytable ";
if(!empty($squery)) { $query .= "LIKE \"%$squery%\" ";}
$query .= "WHERE p16_jaksa1 !='0' ORDER BY uid DESC LIMIT $start,$hits";
$res = mysql_query($query);

print ('<table class="tableWithFloatingHeader" width="100%"  border="0" cellspacing="1" cellpadding="1" bgcolor="#B05800">
        <thead><tr>
<th width="80%"><strong>NAMA TERSANGKA | SURAT DARI | PASAL</strong></th>
<th width="10%"><strong>Tanggal P21</strong></th>

<th width="10%"><strong>POST</strong></th>
</tr></thead>');
 $x=0;
  while($row = mysql_fetch_array($res))
  {
   $x++;
   if($x==2) {$barva = "FF6600";$x=0;} else {$barva = "FFFFCC";$x=1;}
   
//---------kolom 1
print ('<tbody><tr bgcolor=#'.$barva.'><td><b>'.$row['spdp_namatsk'] .'</b><br>');
$polisi1 = $row['spdp_dari'];
 mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$sql=mysql_query("select * from tab_polisi where p_nomor = '$polisi1'");
while ($data=mysql_fetch_array($sql)){
print(''.$data['p_nama'].'');
}
print ('<br><i>'. $row['spdp_pasal'].'</i><br>Jaksa:');
$jaksa1 = $row['p16_jaksa1'];
//loading
$id = $row['uid'];
$p21tanggal = $row['berkas_tahap1p21tgl'];
//loadingend
 mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$sql=mysql_query("select * from tab_personil where daftar_pegid = '$jaksa1'");
while ($data=mysql_fetch_array($sql)){
print('<b>'.$data['daftar_nama'].'</b>');
}
print ('</td>');
 //---------kolom 2
print ('<td><center><b>'.$p21tanggal.'</b></center></td>');

print ('<td>');
if ($p21tanggal == ""){
echo "<center><a href=\"index.pratut.post.tahapan.php?uid=$id&table=$mytable&do=p21\" onclick=\"NewWindow(this.href,'mywin','600','200','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\"><b>POST</b></a></center>";
} elseif ($p21tanggal !== "")
{
}
print ('</td>');
print ('</tr>');} 
print ('</tbody> </table>');
echo "<br><br>Ditampilkan $hits /Halaman";
}
}
?>
    </td>
  </tr>
</table>
