<?php
require_once('../../../includes/load.php');
 $convert_utf8 = function ($s) {
         if (!mb_check_encoding($s, 'UTF-8')) {
             $s = utf8_encode($s);
         }
         return $s;
     };
 $valor=$_REQUEST['valor'];
 $rs= $db->query("SELECT g.IdGranja,g.GNombre,pa.TipoGranja,pa.IdTipoCombustible FROM programaabastecimiento pa INNER JOIN granja g ON pa.id = $valor and pa.IdGranja= g.IdGranja"); 
 $data = array();
 

 while( $rows = mysqli_fetch_assoc($rs) ) {
        $data = array_map($convert_utf8, $rows);     
}
 echo json_encode($data, JSON_UNESCAPED_UNICODE);
?>





 