<table width="100%"  border="0" cellspacing="8" cellpadding="8">
  <tr>
    <td>TOOL untuk Melakukan Edit Postingan </td>
  </tr>
  <tr>
    <td><span class="tabContents">
      <?
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";
$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 "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=tut&i=index&page2=$i#tab1\"> $i |</a>";}}
print ('<br><br>');
$query  = "SELECT * FROM $mytable ";
if(!empty($squery)) { $query .= "LIKE \"%$squery%\" ";}
$query .= "ORDER BY uid 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="30%"><strong>NAMA TERSANGKA/SURAT DARI/PASAL</strong></td>
<td width="20%"><strong>PASAL</strong></td>
<td width="20%"><strong>JAKSA</strong></td>
<td width="9%"><strong>EDIT P16</strong></td>
<td width="7%"><strong>EDIT</strong></td>
<td width="7%"><strong>EDIT SOP</strong></td>
<td width="7%"><strong>DELETE</strong></td>
</tr></thead><tbody>');
 $x=0;
  while($row = mysql_fetch_array($res))
  {
   $x++;
   if($x==2) {$barva = "FF6600";$x=0;} else {$barva = "FFFFCC";$x=1;}
print ('<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'].'');
}

$id = $row['uid'];

print ('<td>'. $row['spdp_pasal'].'</td>');
print ('<td>');
$jaksa1 = $row['p16_jaksa1'];
 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(''.$data['daftar_nama'].'</td>');
print ('<td>');
echo "<a href=\"index.print.spdp.disposisi.php?uid=$id&table=$mytable$mytables\" onclick=\"NewWindow(this.href,'mywin','700','450','yes','center');return false\" onfocus=\"this.blur()\" class=\"menupidum\">EDIT P16</a>";
print ('</td>');
}
print ('</b></td>');
echo "<td><a href=\"index.toolsedit.php?uid=$id&table=$mytable&do=editisi\" onclick=\"NewWindow(this.href,'mywin','1000','600','yes','center');return false\" onfocus=\"this.blur()\" class=\"menupidum\">EDIT ISI</a></td>";
echo "<td><a href=\"index.toolsedit.php?uid=$id&table=$mytable&do=editsop\" onclick=\"NewWindow(this.href,'mywin','1000','500','yes','center');return false\" onfocus=\"this.blur()\" class=\"menubin\">EDIT SOP</a></td>";
echo "<td><a href=\"index.toolsedit.php?uid=$id&table=$mytable&do=delete\" onclick=\"NewWindow(this.href,'mywin','600','200','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\">DELETE</a></td>";

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