我試圖回顯我的會話,但未顯示。我認爲會話正在工作,因爲這是與其他頁面相同的代碼。唯一顯示的部分是文字...「你的ID是」和「聯盟主頁」。有人可以幫我弄清楚我的代碼有什麼問題嗎?PHP會話未顯示
<?php
// this starts the session
session_start();
$id = $_SESSION['userid'];
echo "Your id is " . $id;
//this connects to the database
$con = mysql_connect("localhost","yourfan3_jeengle","armyjoe30");
mysql_select_db("yourfan3_demo", $con);
//gets info for user
$result = mysql_query("SELECT * FROM League_Info WHERE User_ID = '$id'");
$result2 = mysql_fetch_array($result);
$leaguename = $result2['League'];
echo $leaguename;
//$result31 = $result2['Members'];
//$result32 = $result2['League_Password'];
//checks if league name exists
$memberslist = mysql_query("SELECT User_ID FROM League_Info WHERE League = '$leaguename'");
?>
<html>
<head>
</head>
<body>
League Home
</body>
</html>
檢查錯誤日誌。是否有任何錯誤,警告或通知? – icktoofay 2012-08-05 01:44:02
請停止使用古老的MySQL擴展編寫新代碼:它不再被維護,並且社區已經開始[棄用過程](http://news.php.net/php.internals/53799)。相反,您應該使用改進的[MySQLi](http://php.net/mysqli)擴展或[PDO](http://php.net/pdo)抽象層。 – DavChana 2012-08-05 05:38:28