<?php
include('database_connection.php');
$query = "SELECT * FROM tbl_image ORDER BY image_id DESC";
$statement = $connect->prepare($query);
$statement->execute();
$result = $statement->fetchAll();
$number_of_rows = $statement->rowCount();
$output = '';
$output .= '
<script src="http://www.coindez.com/js/lightbox.js" type="c74f6d303e934e3d7d4012ad-text/javascript"></script>

 <table class="table table-bordered table-striped" >
  <tr>
<!--   <th>Sr. No</th> //-->
   <th>Image</th>
   <!-- <th>Name</th> //-->
   <th>Remarks</th> 
<!--   <th>Edit</th> //-->
   <th>Delete</th>
  </tr>
';
if($number_of_rows > 0)
{
 $count = 0;
 foreach($result as $row)
 {
  $count ++; 
  $output .= '
  <tr>
<!--   <td width="200">'.$count.'</td> //-->
   <td width="150">
<a href="files/'.$row["image_name"].'" data-lightbox="'.$row["image_name"].'" data-title="'.$row["image_name"].'">
<img src="files/'.$row["image_name"].'" class="img-thumbnaill" width="150" height="150"  data-lightbox="'.$row["image_name"].'" data-title="'.$row["image_name"].'"/></a>
</td>
<!--   <td>'.$row["image_name"].'</td> //-->
   <td>'.$row["image_description"].'</td> 
<!--   <td width="200"><button type="button" class="btn btn-warning btn-xs edit" id="'.$row["image_id"].'">Edit</button></td> //-->
   <td width="200"><button type="button" class="btn btn-danger btn-xs delete" id="'.$row["image_id"].'" data-image_name="'.$row["image_name"].'">Delete</button></td>
<input type="hidden"  id="'.$row["image_id"].'" name="'.$row["image_name"].'">
  </tr>
  ';
 }
}
else
{
 $output .= '
  <tr>
   <td colspan="6" align="center">No Data Found</td>
  </tr>
 ';
}
$output .= '</table>';
echo $output;
?>
