<?php

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

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

/* GET IMAGE */

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

$row = mysqli_fetch_assoc($q);

if($row)
{

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

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

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

}

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