<?php
  
  $qry=mysqli_query($mysqli,"SELECT * FROM tentang_kami ORDER BY id DESC");

  echo "<h3 align=\"right\" style=\"padding-right:10px\"><a href='?action=add_about' style=\"color:#FF0066\">Tambah Info Tentang Kami</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>Info Tentang Kami</th>
        
        <th width='10%'>Opsi</th>
        </tr>"; 
    while($data=mysqli_fetch_array($qry)){
      if(!empty($data["foto"])){
        $foto="<img src='../foto_berita/$data[foto]' />";
      }else{
        $foto="";
      }
      echo "<tr bgcolor=\"#fffcfc\">
          <td align=\"center\" valign=\"top\">$no</td>
          <td valign=\"top\"><h4>$data[judul]</h4>Oleh: $data[penulis] - $data[tanggal]<br/><br/>$foto<br/>$data[isi]</td>
          
          <td valign=\"top\" align=\"center\"><a href=\"?action=edit_about&id=$data[id]\"><img src=\"images/edit.gif\" /></a>&nbsp;|&nbsp;<a href=\"_del_about.php?id=$data[id]\" onclick=\"return confirm('Yakin akan menghapus info tentang kami dengan judul $data[judul] ?')\"><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>Info Tentang Kami</th>
        
        <th width='10%'>Opsi</th>
        </tr>";
    
    echo "<tr>
          <td colspan='3' align='center'>Tidak ditemukan info tentang kami</td>
           </tr>";    
    echo "</table>";
  }
?>