0
我有這個php代碼,我不知道我怎麼能把所有這些數組發送到代碼的末尾,只有一個數組,以便我可以發送這個數組到android?我在哪裏接收我在android中發送的對象?
$username = $_POST["username"];
$locations_string = "";
$names = array();
$response1= array();
$response2= array();
$user_record = mysql_query("SELECT * FROM users WHERE username='$username'");
$value = mysql_fetch_array($user_record);
$userlocation = $value['location'];
$query = mysql_query("SELECT * FROM AllFriendsExceptBlocked WHERE username ='$username' ");
while($row = mysql_fetch_array($query)){
array_push($names , $value["friendname"]);
echo $row['friendname']. " - ". $row['location'];
echo "<br />";
}
for($i=0; $i < count($names) ; $i++){
$friend = $names[$i];
$user_record = mysql_query("SELECT * FROM AllFriendsExceptBlocked WHERE friendname='$friend' ");
$value = mysql_fetch_array($user_record);
$locations_string = $locations_string . "," . $value['location'];
}
$response["message"] = "send locations of friends in AllFriendsExceptBlocked";
$response1["panicedUserLocation"] = $userlocation;
$response2["locations"] = $locations_string;
echo json_encode($response);
json_encode($response);
echo json_encode($response2);
json_encode($response2);
echo json_encode($response2);
json_encode($response2);
現在我怎麼能接收到我從Android中發送的PHP響應?
好吧我做錯了我應該只發送一個數組我不能發送所有這些數組!所以有關如何將所有這些響應綁定在一起的想法? – user3101219
你可以在一個數組中嵌套數組,例如:{{},{}} –