<?php
	session_start();

	if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
		return;
	}

	include("connect.php");
	
	$spotmid=(int)mysqli_real_escape_string($conn,$_GET['id']);
	
	$eve15="SELECT * FROM res_booking_detail WHERE spotmid=$spotmid";
	
	$re15 = mysqli_query($conn, $eve15);
	if(mysqli_num_rows($re15) > 0)
	{
			$_SESSION['msg1'] = "Hall Already Booked So Record Can't be Deleted";
	}
	else
	{	
	
	$query="delete from res_spot_master where spotmid=$spotmid";
	$result= mysqli_query($conn, $query) or die("Error");
	
	$query1="delete from res_spot_detail where spotmid=$spotmid";
	$result1= mysqli_query($conn, $query1) or die("Error");
	
	$query2="delete from res_availibility_detail where spotmid=$spotmid";
	$result2= mysqli_query($conn, $query2) or die("Error");
		
	$_SESSION['msg'] = "Record deleted successfully";
	}
	header('Location: hall.php');
	
?>