所有其他具有相同数据库连接的页面都可以正常工作,但是此页面需要10-15分钟的加载时间。
它产生正确的输出,但是花费很长时间,尽管该表“ user”只有2条记录。
我错过了什么东西或犯了一些错误吗?
$conn = mysqli_connect("localhost","root","","myprojectdatabase");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$result = mysqli_query($conn, "SELECT * FROM user ");
while( false !== ($row = mysqli_fetch_assoc($result))){
echo "<pre>";
echo $row['username'];
}
$conn->close();
答案 0 :(得分:1)
尝试使用下面的代码,看看它是否对您有用
$conn = mysqli_connect("localhost","root","","myprojectdatabase");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$result = mysqli_query($conn, "SELECT * FROM user");
while( false !=($row = mysqli_fetch_assoc($result)))
{
echo"<pre>";
echo $row['username'];
}
$conn->close();