<?php
include("auth.php");
include("config/db.php");

$id = (int)$_GET['id'];

$data = mysqli_fetch_assoc(mysqli_query($conn, "SELECT image FROM case_studies WHERE id=$id"));
if($data){
  unlink("uploads/case_studies/".$data['image']);
}

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

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