我基本上希望它選擇只記錄在當前用戶多數民衆贊成,然後顯示有用戶名和點,而不是它顯示數據庫中的所有用戶PHP,只能選擇在用戶名登錄,從數據庫
這是代碼,顯示它
<?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!";
}
?>
哪裏是'where'在查詢子句.. –
我想這就是問題所在。什麼我會選擇當前登錄的用戶嗎? –
'當用戶名='$ _SESSION ['LOGGEDIN']'' –