<?php
ob_start();
include("../connect.php");
if(isset($_POST['category_id']))
{ 
    $c_id = $_POST['category_id']; 
	$response['product']=array();
	$res = mysqli_query($con,"SELECT * FROM tbl_master_product where category_id='$c_id' AND status='Active'");
	$row=mysqli_num_rows($res);
	if($row>0)
	{	 
       while($row=mysqli_fetch_array($res))
	   {  
          $products['product_id'] = $row['product_id'];
		  $products['product_name'] = $row['product_name'];
		  $products['hsn_code'] = $row['hsn_code'];
		  $products['mrp'] = $row['mrp'];
		  $products['product_price'] = $row['product_price'];
		  $products['mAh_compatible'] = $row['mAh_compatible'];
		  $products['warranty'] = $row['warranty'];
		  $products['warranty_description'] = $row['warranty_description'];
		  $products['status'] = $row['status'];
       
          array_push($response['product'],$products);		  
	   }

	   $response['success']=1;
	   $response['details']="Product Data Fetched Succesfully";  
	}
    else
	{
		$response['success']=0;
		$response['details']="Product Data Not Available...!!";
	} 
}
else
{	
	$response['success']=0;
	$response['details']="Required fields missing";
}
echo json_encode($response);
?> 