
PK 
| ADDRLIN : C:/Inetpub/vhosts/dharmayatra.co.in/httpdocs/admin/gallery/ |
| Current File : C:/Inetpub/vhosts/dharmayatra.co.in/httpdocs/admin/gallery/delete.php |
<?php
include('../includes/auth.php');
include('../../includes/db.php');
$id = $_GET['id'];
// Get image name
$res = mysqli_query($conn, "SELECT image FROM gallery WHERE id=$id");
$row = mysqli_fetch_assoc($res);
// Delete file from folder
if(file_exists("../../uploads/".$row['image'])){
unlink("../../uploads/".$row['image']);
}
// Delete from DB
mysqli_query($conn, "DELETE FROM gallery WHERE id=$id");
header("Location: index.php");
