<?php
include("../config/database.php");
$sqlOrder  = mysqli_query($cn,"SELECT * FROM `tbl_product` where `status`=1");
$count     = mysqli_num_rows($sqlOrder);
if($count > 0)
{	
    $productlist = array();	
    while($data = mysqli_fetch_array($sqlOrder))
    {	$unitList      = array();		        		
		
		$unitList[]    = array('unit1'=>$data['unit2'],'unit2'=>$data['unit1']);
		//array_push($unitList,$data['unit2']);
		//array_push($unitList,$data['unit1']);	 
		$productlist[] = array("product_id"=>$data['id'], "product_name"=>$data['product_name'], "sku"=>$data['sku'], "price"=>$data['price'], "pc_price"=>$data['set_price'], "unit"=>$unitList);						   		
	}
    $arr  = array("status"=>true, "productList"=>$productlist);	
}
else
{
    $arr = array("status"=>false, 'msg'=>"Product List Not Found.");
}
echo json_encode($arr);		    	
mysqli_close($cn);
?>