0
我有这个表在MySQL数据库对应一个给定的值返回多个值
number | name | friend ------------------------------- 1 |John | Kloey 2 |John | Tara 3 |Marco | Tia 4 |John | Clara
我需要在对应于约翰的名字列在一个数组或一个字符串或朋友列的所有名称什么,然后我可以在android中接收? 我该怎么做?
这里是我的PHP代码,但它只是返回的第一个名字是kloey只有
$username = $_POST["username"];
$recordofusername = mysql_query("SELECT * FROM friends WHERE name='$username'");
$value1 = mysql_fetch_array($recordofusername);
$user_friendname = $value1['friend'];
$response["userfriends"] = $user_friendname;
echo json_encode($response);
看你以前的问题,你真的** **有熟悉[upvoting and accepting](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work)答案的概念。如果不这样做,人们会停止帮助你,因为你不明白他们的时间和精力。 – peterm