$ligne["cheminPreuve"] = $cheminPreuve; // push single row into final response array array_push($response["dernierDefi"], $ligne); } $response["success"] = 1; //$response["error"] = FALSE; } else { $response["error"] = TRUE; $response["error_msg"] = "Aucun defi propose pour cette personne"; } echo json_encode($response); } else { if ($tag == "listeAmi") { $pseudo = $_POST['pseudo']; $result = $db->listeAmiFrom($pseudo); $result2 = $db->listeAmiTo($pseudo); if ($result) { $response["listeAmi"] = array(); while ($row = mysql_fetch_array($result)) { $ligne = array(); //$idDefi=$row["idDefi"]; $ligne["amiFrom"] = $row["amiFrom"]; $ligne["amiTo"] = $row["amiTo"]; $ligne["amiDate"] = $row["amiDate"]; $ligne["amiLien"] = $row["amiLien"]; // push single row into final response array array_push($response["listeAmi"], $ligne); } $response["success"] = 1; //$response["error"] = FALSE; }