-2
我想从数据库表中检索内容并使用php脚本显示它们。我成功检索并显示了内容,并使用元标记每5秒刷新一次内容。该页面仍然不令人耳目一新。你们能帮我解决这个问题吗?在这里,我附上我的代码:刷新网页的内容
<html>
<head>
<meta http-eqiv="refresh" content="2">
</head>
<body>
<?php
session_start();
$_SESSION['username'];
$con=mysqli_connect("localhost","root","","oracle");
$result=mysqli_query($con,"SELECT * from message order by timestamp DESC");
while($row=mysqli_fetch_row($result))
{
echo "<font color='red'><b><i>" .$row['2']."
</i></b></font> says: <font color='green'><b><i>"
. $row['0']. "</i></b></font> at:" .
$row['1']. "<br>";
}
?>
</body>
</html>
您可能还需要对'在session_start阅读一些文档()'。 – miken32
你也可以看看AJAX。你不必用ajax刷新整个页面,而只需要你需要的页面块 – JapanGuy