最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php mysql数据库操作教程
时间:2022-06-24 19:07:54 编辑:袖梨 来源:一聚教程网
//连接mysql数据库
代码如下 | 复制代码 |
$link = mysql_connect("localhost", "mysql_user", "mysql_password") or die("could not connect: " . mysql_error()); print ("connected successfully"); mysql_close($link); |
//查询mysql字段名
代码如下 | 复制代码 |
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); $fields = mysql_list_fields("database1", "table1", $link); for ($i = 0; $i < $columns; $i++) { |
//查询数据
代码如下 | 复制代码 |
$conn=mysql_connect("localhost","phpdb","phpdb") or die("不能连接数据库服务器: ".mysql_error()); mysql_select_db("test",$conn) or die ("不能选择数据库: ".mysql_error()); $result = mysql_query("select * from user",$conn); while($row=mysql_fetch_array($result)){ print "name:".$row[1]; print " address:".$row[3]; print " tel:".$row[4]; print " email:".$row[5]; echo |
"
";
}
相关文章
- 黑色四叶草魔法帝之道戈休怎么玩 10-14
- 原神千星奇域进入位置 10-14
- 蜘蛛纸牌网页版入口 无需下载注册点击秒玩 10-14
- 纸房子游戏安装入口 steam正版纸房子购买链接 10-14
- 原神云游戏官网入口 云原神网页版在线地址 10-14
- 我的花园世界最新兑换码分享 我的花园世界白嫖VIP方法介绍 10-14