?
Path : /home/u949514618/domains/karmaasrconsultants.com/public_html/admin/ |
Current File : /home/u949514618/domains/karmaasrconsultants.com/public_html/admin/fetch.php |
<?php include('database_connection.php'); $query = "SELECT * FROM gallery ORDER BY image_id DESC"; $statement = $connect->prepare($query); $statement->execute(); $result = $statement->fetchAll(); $number_of_rows = $statement->rowCount(); $output = ''; $output .= ' <table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th>Sr. No</th> <th>Image</th> <th>Name</th> <th>Image Path</th> <th>Gallery Type</th> <th>Edit</th> <th>Delete</th> </tr> </thead> '; if($number_of_rows > 0) { $count = 0; foreach($result as $row) { $count ++; $output .= ' <tbody> <tr> <td>'.$count.'</td> <td><img src="files/'.$row["image_name"].'" class="img-thumbnail" width="100" height="100" /></td> <td>'.$row["image_name"].'</td> <td>admin/files/'.$row["image_name"].'</td> <td>'.$row["image_description"].'</td> <td><button type="button" class="btn btn-warning btn-xs edit" id="'.$row["image_id"].'">Edit</button></td> <td><button type="button" class="btn btn-danger btn-xs delete" id="'.$row["image_id"].'" data-image_name="'.$row["image_name"].'">Delete</button></td> </tr> </tbody> '; } } else { $output .= ' <tbody> <tr> <td colspan="6" align="center">No Data Found</td> </tr> </tbody> '; } $output .= ' <tfoot> <tr> <th>Sr. No</th> <th>Image</th> <th>Name</th> <th>Image Path</th> <th>Gallery Type</th> <th>Edit</th> <th>Delete</th> </tr> </tfoot> </table> '; echo $output; ?>