<?php

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

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

$data = mysqli_fetch_assoc(mysqli_query($conn,"
SELECT * FROM village_anganwadi WHERE id='$id'
"));

if($data){

$file="../../uploads/anganwadi/".$data['image'];

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

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

echo "<script>alert('Deleted Successfully');window.location='anganwadi_list.php';</script>";