<?php
	
	$qry=mysqli_query($mysqli,"SELECT * FROM produk_hukum ORDER BY deskripsi ASC");

	echo "<h3 align=\"right\" style=\"padding-right:10px\"><a href='?action=add_produk' style=\"color:#FF0066\">Tambah Data Produk Hukum</a></h3>";
	
	if(mysqli_num_rows($qry)>0){
		
		$no=1;
		
		echo "<table width='100%' align='center' cellpadding='0' cellspacing='0' border='1' bgcolor='#C4D9FF'>";
		echo "<tr bgcolor='#fffccc'>
				<th width='5%'>No.</th>
				<th>Deskripsi</th>
				<th>File</th>
				<th width='10%'>Opsi</th>
			  </tr>";	
		while($data=mysqli_fetch_array($qry)){
			echo "<tr bgcolor=\"#fffcfc\">
					<td align=\"center\" valign=\"top\">$no</td>
					<td valign=\"top\">$data[deskripsi]</td>
					<td valign=\"top\"><a href='../file/$data[file]'>$data[file]</a></td>
					<td valign=\"top\" align=\"center\"><a href=\"?action=edit_produk&id=$data[id]\"><img src=\"images/edit.gif\" /></a>&nbsp;|&nbsp;<a href=\"_del_produk.php?id=$data[id]\" onclick=\"return confirm('Yakin akan menghapus data produk hukum $data[deskripsi] ?')\"><img src=\"images/delete.gif\" /></a></td>
					
			     </tr>";
			$no++;  
		}
		
		echo "</table>";
	}else{
	
		echo "<table width='100%' align='center' cellpadding='0' cellspacing='0' border='1' bgcolor='#C4D9FF'>";
		echo "<tr bgcolor='#fffccc'>
				<th width='5%'>No.</th>
				<th>Deskripsi</th>
				<th>File</th>
				<th width='10%'>Opsi</th>
			  </tr>";
		
		echo "<tr>
					<td colspan='4' align='center'>Tidak ditemukan data produk hukum</td>
			     </tr>";		
		echo "</table>";
	}
?>