我基本上希望它只选择登录的当前用户,然后在那里显示用户名和点,而不是显示数据库中的所有用户
这是显示它的代码
<?php
include("connect.php"); // Includes the file connect.php to connect to database
session_start(); // Starting session cookies
if($_SESSION['LOGGEDIN'] == 1) //Checking if they have the session cookie
{
$result = mysql_query("SELECT * FROM userdata");
echo "<table border='1'>
<tr>
<th>Username</th>
<th>Points</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['points'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
}
else
{
echo "<title>Error!</title>";
//Doesn't have session cookie
echo "YOU ARE NOT LOGGED IN!";
}
?>