在登录:
$_SESSION['username'] = $username;
$id = mysql_query("SELECT `id` FROM `users` WHERE `username`='" . $username . "'");
$_SESSION['logged_in'] = 1;
$_SESSION['id'] = $id;
索引(试图在此处显示)
Welcome, <?= $username ?><br> ((works))
ID: <?= $id ?>
id 只是显示为 0,而实际上它是 1。