<?php 
 
 require 'db.php';
$data = json_decode(file_get_contents('php://input'), true);
$uid = $data['uid'];
$shop_id = strip_tags(mysqli_real_escape_string($con,$data['shop_id']));
$shop_code = strip_tags(mysqli_real_escape_string($con,$data['shop_code']));
if($uid == '' || $shop_id == '')
{
	$returnArr = array("ResponseCode"=>"401","Result"=>"false","ResponseMsg"=>"Something Went wrong try again !");
}
else 
{
	$cy = $con->query("select * from distance_db where status = 1 and shop_id = '$shop_id' and shop_code = '$shop_code' ORDER BY distance ASC");
	$count = $con->query("select * from distance_db where status = 1 and shop_id = '$shop_id' and shop_code = '$shop_code'")->num_rows;
	if($count != 0)
	{
    	$p = array();
    	$q = array();
    	while($row = $cy->fetch_assoc())
    	{
    		$p['id'] = $row['id'];
    		$p['distance'] = $row['distance'];
    		$p['dcharge'] = $row['dcharge'];
    		$q[] = $p;
    	}
    	
    	$count1 = $con->query("select * from payment_type where status = 1 and shop_id = '$shop_id' and shop_code = '$shop_code'")->num_rows;
    	$cs = $con->query("select * from payment_type where status = 1 and shop_id = '$shop_id' and shop_code = '$shop_code' ORDER BY id ASC");
    	if($count1 != 0)
    	{
    	    $r = array();
        	$s = array();
        	while($row1 = $cs->fetch_assoc())
        	{
        		$r['name'] = $row1['name'];
        		$s[] = $r;
        	}
    	}

    	$returnArr = array("ResponseCode"=>"200","Result"=>"true","ResponseMsg"=>"Distance List","ResultData"=>$q,"ResultPayData"=>$s);
    }
    else 
    {
    	$returnArr = array("ResponseCode"=>"401","Result"=>"false","ResponseMsg"=>"No Distance!");
    }
}
echo json_encode($returnArr);
mysqli_close($con);
?> 	