2 回答

TA貢獻(xiàn)1783條經(jīng)驗(yàn) 獲得超4個(gè)贊
要看你的要顯示資料庫的那一個(gè)值。
mysql_* 是不要再用了。用mysqli比較安全。
mysql_fetch_row() //1 tobby tobby78$2
<html><?phpinclude('db.php');$query=mysql_query("select * from tb");$row=mysql_fetch_row($query);echo $row[0];echo $row[1];echo $row[2];?></html>
mysql_fetch_assoc() // 1 tobby tobby78$2
<html><?phpinclude('db.php');$query=mysql_query("select * from tb");$row=mysql_fetch_assoc($query);echo $row['id'];echo $row['username'];echo $row['password'];?></html>
mysql_fetch_array() // 1 tobby tobby78$2
<html><?phpinclude('db.php');$query=mysql_query("select * from tb");$row=mysql_fetch_array($query);echo $row['id'];echo $row['username'];echo $row['password'];<span style="color: #993300;">/* here both associative array and numeric array will work. */</span>echo $row[0];echo $row[1];echo $row[2];?></html>
- 2 回答
- 0 關(guān)注
- 707 瀏覽
添加回答
舉報(bào)