当前代码:
<?php
session_start();
if ($_SESSION['username']) {
echo "Signed in as " . "$_SESSION[username]" . "<br />" . "<a href='logout.php'>Log out</a>";
//Get user info.
$results = mysql_query("SELECT * FROM users WHERE username=$_SESSION[username]");
while($row = mysql_fetch_array($results) {
$db_username = $row['username'];
echo $db_username;
}
}
else {
echo "Log in";
}
?>
不幸的是,当返回 MySQL 应该得到的值时,我遇到了错误。知道为什么吗?