<?php
// 创建连接
$link
= mysqli_connect
('localhost', 'zzf', '123456');
// 检测连接
if (!$link
) {
exit
("数据库连接失败");
}
//设置字符集
mysqli_set_charset
($link
,'utf8');
//选择数据库
mysqli_select_db
($link
,'zzf');
//准备sql语句
$sql
="select * from admin_info";
//发送语句
$res
=mysqli_query
($link
,$sql
);
//var_dump
($res
);
//处理数据集
$result
=mysqli_fetch_assoc
($res
);
var_dump
($result
);
//关闭数据库
mysqli_close
($link
);
echo
"连接成功";
?
>
转载请注明原文地址:https://ipadbbs.8miu.com/read-452.html