为了账号安全,请及时绑定邮箱和手机立即绑定

一个PHP echo问题 ?

一个PHP echo问题 ?

PHP
DIEA 2019-02-07 11:07:49
一个PHP echo问题 
查看完整描述

2 回答

?
慕娘9325324

TA贡献1783条经验 获得超4个赞

要看你的要显示资料库的那一个值。

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>


查看完整回答
反对 回复 2019-03-13
  • 2 回答
  • 0 关注
  • 688 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信