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
你可以在一个数组中嵌套数组,例如:{{},{}} –