請教大家,有一個陣列,想從資料表取出值來填入,要怎麼改呢?
$sql = "select sid,township from tbl_township where pid=1";
$res = db_query($sql);
while (list($sid,$township)=mysql_fetch_row($res)):
endwhile;
陣列型式如下:$provinces = array(
array('sid' => 'bj', 'township' => 'Beijing'),
array('sid' => 'hb', 'township' => 'Hubei')
);
$sql = "select sid,township from tbl_township where pid=1";
$res = db_query($sql);
while (list($sid,$township)=mysql_fetch_row($res)):
endwhile;
陣列型式如下:$provinces = array(
array('sid' => 'bj', 'township' => 'Beijing'),
array('sid' => 'hb', 'township' => 'Hubei')
);
$provinces[] = $row;
}