<?php
       $cliente_id = isset($_REQUEST['cliente_id']) ? $_REQUEST['cliente_id'] : '-1';
       include '../rdb/conn.php';


	$sql="SELECT distinct  r.id,r.nombre FROM repartidor_zona rz,repartidores r,clientes c where c.zona_id=rz.zona_id and r.id=rz.repartidor_id ";
	
	if ($cliente_id<>'-1') {
	    $sql.="and c.id=$cliente_id";
	} 
	
	$rs = mysqli_query( $conn,$sql);

	$rows = array();
	while($row = mysqli_fetch_assoc($rs)){
	    $rows[] = $row;
}
	echo json_encode($rows);
?>