<?php
session_start();

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

	include("connect.php");
	
	date_default_timezone_set("Asia/Singapore");
	$mdate1= date('Y-m-d H:i:s');
	$mdate2= date('d-m-Y');
	

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