我写了这个简单的代码和这个连接到 mysql 数据库的表。它获取我在数据库中插入的数据,我想要的是页面自动刷新而无需刷新整个页面。
我的代码:
<html>
<head>
<title>Whats Up?</title>
</head>
<body>
<a href="Register.php">Register</a> <a href="login.php">Login</a>
<?php
mysql_connect('localhost', 'root');
mysql_select_db('summerinstitute');
$query="SELECT * FROM students";
$result=mysql_query($query);
echo "<table border=\"1\">";
while ($row = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<td>";
echo $row['fname'];
echo "</td>";
echo "<td>";
echo $row['lname'];
echo "</td>";
echo "<td>";
echo $row['username'];
echo "</td>";
echo "<td>";
echo $row['Email'];
echo "</td>";
echo "</tr>";}
?>
</body>
</html>