<?php
ob_start();
include("../connect.php");
$response = array();
if(isset($_POST['product_id']) && isset($_POST['status']))
{  
   $p_id=$_POST['product_id'];
   $status=$_POST['status'];
   
	if($status=='Active')
	{
	  $update_status = mysqli_query($con,"update tbl_master_product set status='Active' where product_id='$p_id'");
	}
	else
	{
	  $update_status = mysqli_query($con,"update tbl_master_product set status='Deactive' where product_id='$p_id'");	
	}
	
	if($update_status)
	{
	$response['success']=1;	
	$response['details']="Product Successfully $status !";
	}
	else
	{
	$response['success']=0;	
	$response['details']="Error In Product Status Change !"; 	
	}	   
}	
else
{	
	$response['success']=0;
	$response['details']="Required fields missing";
}
echo json_encode($response);
?>
