<?php
include('../../config.php'); // db connection

if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
  die("Invalid ID");
}

$id = $_GET['id'];

// Optionally check if theatre exists first
$res = mysqli_query($con, "SELECT * FROM tbl_theatre WHERE id='$id'");
if (mysqli_num_rows($res) == 0) {
  die("Theatre not found");
}

// Perform delete
mysqli_query($con, "DELETE FROM tbl_theatre WHERE id='$id'");
header("Location: theatre_list.php?msg=deleted");
exit;
