<?php
  $id_gallery=mysqli_real_escape_string($mysqli,$_GET["id_album"]);
  
  $qrym=mysqli_query($mysqli,"SELECT * FROM m_gallery WHERE id_gallery='$id_gallery'");
  $dtm=mysqli_fetch_array($qrym);
  
  echo "<h2>Album: $dtm[judul]<br/>Tanggal: $dtm[tanggal]</h2>";
  
  
  $qry=mysqli_query($mysqli, "SELECT * FROM t_gallery WHERE id_gallery='$id_gallery'");
  if(mysqli_num_rows($qry)>0){
    
    $no=1;
    
    echo "<table width='100%' align='center' cellpadding='0' cellspacing='0' border='0' bgcolor='#C4D9FF'>";
    
	/*echo "<tr bgcolor='#fffccc'>
        <th width='5%'>No.</th>
        <th width='20%'>File Foto</th>
		<th width='65%'>Keterangan</th>
        </tr>"; 
	*/
	
    while($data=mysqli_fetch_array($qry)){
      if(!empty($data["file_foto"])){
        $foto="<img src='foto_berita/$data[file_foto]' width='320' height='240'/>";
      }else{
        $foto="";
      }
	  
	 
      echo "<tr bgcolor=\"#fffcfc\">
          
          <td valign=\"top\" width='320'>$foto</td>
		  <td valign=\"top\">$data[keterangan]</td>
		  </tr>";
		echo "<tr bgcolor=\"#fffcfc\"><td colspan='2'><br/></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>File Foto</th>
		<th>Keterangan</th>
        
        </tr>";
    */
	
    echo "<tr>
          <td colspan='2' align='center'>Tidak ditemukan foto...</td>
           </tr>";    
    echo "</table>";
  }
  
  echo "<br/><br/>&nbsp;";
?>