一列要如何充值?
教大家,有一列,想料表取出值填入,要怎改呢?
- PHP code
$sql = "select sid,township from tbl_township where pid=1";$res = db_query($sql); while (list($sid,$township)=mysql_fetch_row($res)): endwhile;
列型式如下:
- PHP code
$provinces = array(array('sid' => 'bj', 'township' => 'Beijing'),array('sid' => 'hb', 'township' => 'Hubei'));
[解决办法]
while($row = mysql_fetch_assoc($res)) {
$provinces[] = $row;
}