<?php
	session_start();

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

	include("connect.php");
	
	$statusmid=(int)mysqli_real_escape_string($conn,$_GET['id']);

	
	$eve1="select statusmid from res_collegeapp_master where statusmid=$statusmid";
	$re1 = mysqli_query($conn, $eve1);
	$document=mysqli_num_rows($re1);
	
	$eve1="select statusmid from res_admission_master where statusmid=$statusmid";
	$re1 = mysqli_query($conn, $eve1);
	$document=mysqli_num_rows($re1);
	
	if($document==0)
	{
		$query="delete from res_status_master where statusmid=$statusmid";
		$result= mysqli_query($conn, $query) or die("Error");
		
		$_SESSION['msg']="Record deleted successfully";
	}
	else
	{ 
		$_SESSION['msg1'] = "This Data is already used.";
	}
	
	header('Location: status.php');
	

?>