<?php
//连接数据库
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database_name";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
//查询数据
$sql = "SELECT * FROM arr";
$result = mysqli_query($conn, $sql);
//输出内容
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo "内容: " . $row["nr"] . "<br>";
}
} else {
echo "0 条结果";
}
mysqli_close($conn);
?>