<?php $conn=mysqli_connect("127.0.0.1","root","密码","db_favorite") or die("数据库服务器连接错误".mysqli_error()); mysqli_select_db($conn,"db_favorite") or die("数据库访问错误".mysqli_error()); mysqli_query($conn,"set names utf-8"); $query = mysqli_query($conn, 'select * from tb_admin;'); if (!$query) { exit('<h1>查询数据失败</h1>'); } $item = mysqli_fetch_assoc($query); if (!$item) { exit('<h1>抓取数据失败</h1>'); } ?> <!DOCTYPE html> <html> <head> <title>PHP动态实现从数据库中访问链接到标签a的herf中</title> </head> <body> <a href="<?php echo $item['address']; ?>"><?php echo $item['address']; ?></a> </body> </html>
PHP动态实现从数据库中访问链接到标签a的herf中
猜你喜欢
转载自www.cnblogs.com/wlei5206/p/12743967.html
今日推荐
周排行