JezK
Edit File: gallery.php
<?php include('./app/admin_functions.php'); $admin= new admin(); $tableRowCount=0; $galleryList=$admin->getGalleryList(); $galleryImageTableBody='<tr><td colspan="10" class="text-center">No Gallery Images Found.</td></tr>'; if($galleryList != false) { $galleryImageTableBody=''; $galleryFolder='uploads'; $counter=1; foreach($galleryList as $row) { $galleryRow='<tr scope="row" class="record">'; $galleryRow.='<td>'.$counter.'</td>'; $galleryRow.='<td><img class="gallery-list-thumb" src="./'.$galleryFolder.'/'.$row['imagepath'].'"'.$row['gallery_id'].'</td>'; $galleryRow.='<td class="text-center"><label class="glyphicon glyphicon-eye-open"></label> <a href="viewgallery.php?gal_img_id='.$row['gallery_id'].'"> view </a><label class="glyphicon glyphicon-trash"></label> <a href="#" class="delete-gallery-img" data-record-id="'.$row['gallery_id'].'">Delete</a></td>'; $galleryRow.='</tr>'; $galleryImageTableBody.=$galleryRow; $counter++; $tableRowCount++; } } if(isset($_SESSION['add_gallery_image_status'])) { if($_SESSION['add_gallery_image_status'] == 'success') { echo "<script>alert('New Gallery Images Added Successfully.');</script>"; unset($_SESSION['add_gallery_image_status']); } } $current_page='gallary'; $current_heading='Gallery'; include('header.php'); ?> <div class='contain'> <!--<h1>Gallery</h1> <hr>--> <div class=""> <div class='pull-right bttn'> <a href='addgallery.php'><input type='button' class='btn btn-info ' value='ADD'></a> </div> <br><br> <div class='table-responsive'> <table class="tbl table data-table"> <thead> <tr> <th class="col-md-2">S.No</th> <th class="col-md-4">Images</th> <th class="col-md-6 text-center">Action</th> </tr> </thead> <tbody> <?php echo $galleryImageTableBody; ?> <!--tr> <td scope="row">1</td> <td>img1</td> <td>Annaparthi</td> <td><label class="glyphicon glyphicon-eye-open"></label> <a href='viewgallery.html'> view</a></td> </tr--> </tbody> </table> </div> </div> </div> <hr> <?php if($tableRowCount > 0) { /* Run Data Table when Rows are more than One. */ echo '<script> $(document).ready(function(){ $(".data-table").DataTable({ "lengthMenu": [[5, 10, 20, 50, 100], [5, 10, 20, 50, "All"]] } ); }); </script>'; } include('footer.php'); ?>