php
connect_error) {
die("连接失败: " . $conn->connect_error);
}
// 执行查询
$sql = "SELECT id, name, email FROM users";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. " - Name: " . $row["name"]. " - Email: " . $row["email"]. "
"; } } else { echo "0 结果"; } $conn->close(); ?>
"; } } else { echo "0 结果"; } $conn->close(); ?>
顶一下
(0)
0%
踩一下
(0)
0%
- 相关评论
- 我要评论
-