Per prima cosa ho provato a modificare la classe php utilizzando la funzione json_encode come segue:
(codice:<?php include_once("../include/config.php"); if($_POST){ global $_CONFIG; $result = mysql_query(" SELECT DISTINCT U.name as name,U.surname as surname,U.uid as uid,F.id_foto as id_foto FROM ".$_CONFIG['table_utenti']." U, ".$_CONFIG['table_location']." L, ".$_CONFIG['table_body']." B, ".$_CONFIG['table_foto']." F WHERE (U.name LIKE '".$_POST['name']."' OR U.surname LIKE '".$_POST['name']."') AND L.city LIKE '".$_POST['city']."' AND U.uid = L.uid AND U.uid = B.uid AND U.uid = F.uid ORDER BY F.id_foto DESC "); $data = array(); while($tmp = mysql_fetch_assoc($result)){ array_push($data, $tmp); }; json_encode($data); echo $data; } ?>
Poi ho provato quest'altra soluzione:
codice:<?php include_once("../include/config.php"); if($_POST){ global $_CONFIG; $result = mysql_query(" SELECT DISTINCT U.name as name,U.surname as surname,U.uid as uid,F.id_foto as id_foto FROM ".$_CONFIG['table_utenti']." U, ".$_CONFIG['table_location']." L, ".$_CONFIG['table_body']." B, ".$_CONFIG['table_foto']." F WHERE (U.name LIKE '".$_POST['name']."' OR U.surname LIKE '".$_POST['name']."') AND L.city LIKE '".$_POST['city']."' AND U.uid = L.uid AND U.uid = B.uid AND U.uid = F.uid ORDER BY F.id_foto DESC "); $rows = array(); while ($row = mysqli_fetch_assoc($result)) { $rows[] = array( 'name' => $row['name'], 'surname' => $row['surname'], 'id_foto' => $row['id_foto'] ); } echo json_encode($rows); } ?>

Rispondi quotando