<?php
	session_start();

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

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

	
 $eve15="SELECT * FROM res_jobwork_master WHERE fromcompanymid=$cmpmid or tocompanymid=$cmpmid";
	
	$re15 = mysqli_query($conn, $eve15);
	if(mysqli_num_rows($re15) > 0)
	{
			$_SESSION['msg1'] = "Company Already added So Record Can't be Deleted";
	}
	else
	{	
	
	$query="delete from res_company_master where companymid=$cmpmid";
	$result= mysqli_query($conn, $query) or die("Error");

$query1="delete from res_user_master where companymid=$cmpmid";
	$result= mysqli_query($conn, $query1) or die("Error");

	$_SESSION['msg'] = "Record deleted successfully";
	}
	header('Location: businessregister.php');
?>