我有一个数组变量,它将在json中使用。这是我的代码:
$arr = array();
$data=mysql_query("SELECT * FROM t_location WHERE loca_id = '$id' ")or die(mysql_error());
while($a=mysql_fetch_array($data)){
array_push(); //what should i do
{
我想把数据从数据库推送到数组,比如:
$arr= array(
array(
"id" => "1",
"name" => "London",
)
);
有人能帮我吗?
$arr = array();
$data=mysql_query("SELECT * FROM t_location WHERE loca_id = '$id' ")or die(mysql_error());
while($a=mysql_fetch_array($data)){
array_push($arr,$a);
{