我无法使用内部联接从不同的表中检索值,输出始终不检索任何内容。此外,没有错误消息,我无法确定代码中出了什么问题。有人可以帮忙吗?我会非常感激。这是我的代码的一部分..
<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("student_records",$con);
if(isset($_COOKIE['username']))
{
if($_COOKIE['username']!='admin')
{
$tbl6=mysql_query("SELECT A.LName, A.FName, A.MName, B.YearLevel
FROM student as A INNER JOIN stud_course as B ON A.StudNo=B.StudNo INNER JOIN course as C ON B.CourseCode=C.CourseCode INNER JOIN religion as D ON A.ReligionID=D.ReligionID
WHERE A.StudNo = '".mysql_real_escape_string($_COOKIE['username'])."' ");
while($row=mysql_fetch_array($tbl6))
{
echo "<td>".$row['LName']."</td><td>".$row['FName']."</td><td>".$row['MName']."</td><td>".$row['Course']."</td><td>".$row['YearLevel']."</td><td>".$row['EAdd']."</td><td>".$row['ReligionName']."</td></tr>";
}
}
}
?>