<?php
require_once ("varables.php");

$myJSON['routdt'] = array();
$myJSON['success']="0";
if(isset($_POST["nekot"]) && isset($_POST["an1d"]))
{
    $id =$_POST["an1d"];
    $connect = @mysqli_connect($hostname,$username,$password,$database);
    if($connect)
    {
        @mysqli_query($connect,"SET CHARACTER SET utf8;");
		$query_all = "SELECT ".$tbl_customer.".address,".$tbl_customer.".C_name,".$tbl_customer.".C_Code,".$tbl_customer.".id,".$tbl_customer.".last_visit,".$tbl_customer.".last_order,".$tbl_customer.".shop_name,".$tbl_routdtl.".rdtid,".$tbl_routdtl.".sort,".$tbl_customer.".lat,".$tbl_customer.".lng,".$tbl_customer.".blackList FROM ".$tbl_customer." , ".$tbl_routdtl." WHERE ".$tbl_routdtl.".R_id='".$id."' AND ".$tbl_customer.".id = ".$tbl_routdtl.".C_id ORDER BY ".$tbl_customer.".blackList, ".$tbl_customer.".last_visit, ".$tbl_customer.".last_order, ".$tbl_routdtl.".sort" ;
		$allres = @mysqli_query($connect,$query_all);
		if($allres){
			while($row = @mysqli_fetch_assoc($allres)){
				array_push($myJSON["routdt"], $row);
				$myJSON['success']="200";
			}
		}
		else{
		$myJSON['success']=@mysqli_error($connect);
		}
	}
	else
		$myJSON['success']="402";
}
echo json_encode($myJSON);
?>
