<?php

include "../../config/master.php";
allowRoles([1,5]);

$id = $_GET['id'] ?? 0;

/* FETCH IMAGE */

$q = mysqli_query($conn,"
SELECT image
FROM village_development_works
WHERE id='$id'
");

$row = mysqli_fetch_assoc($q);

if($row)
{

if(!empty($row['image']))
{
$path="../../uploads/development/".$row['image'];

if(file_exists($path))
{
unlink($path);
}
}

mysqli_query($conn,"
DELETE FROM village_development_works
WHERE id='$id'
");

}

header("Location: development_works_list.php");
exit;