-2
<?
session_start();
$username = $_SESSION["username"];
$lecturername = "SELECT lecturername FROM lecturer WHERE username='$username'";
$sql = "SELECT * FROM publication WHERE lecturername='$lecturername'";
$records = mysql_query($sql);
?>
嘗試使用加入 – gaganshera
'的MySQL。*'因爲我是年輕的擴展名被棄用...使用'mysqli'或'PDO' –
看看你的代碼做什麼。 'SELECT * FROM publication WHERE lecturername ='SELECT lecturername FROM lecturer WHERE username ='$ username''' this will never work。你需要「執行」,「苦惱」,「存儲」和重新查詢。使用「join」和1查詢將會更有效率。 – chris85