<?php
session_start();
include "dbConfig.php";
if (!$_SESSION["valid_user"])
{
// User not logged in, redirect to login page
// Header("Location: login.php");
}
echo "<p>User ID: " . $_SESSION["valid_id"];
echo "<p>Username: " . $_SESSION["valid_user"];
$sql = "SELECT tbl_subject.SubjectID, tbl_subject.SubjectDesc, studentsubjectgrade.Finals
FROM tbl_subject
INNER JOIN studentsubjectgrade
ON tbl_subject.SubjectID=studentsubjectgrade.SubjectID
INNER JOIN academicyr ON studentsubjectgrade.SubjectID=academicyr.SubjectID
WHERE academicyr.Semester = 1";
$result = mysql_query($sql);
$num = mysql_numrows($result);
mysql_close();
?>
<table border='1'>
<tr>
<td>Subject ID</td>
<td>Subject</td>
<td>Finals</td>
</tr>
<?php
for ($i = 0; $i < $num; $i++)
{
$SID = mysql_result($result,$i,"SubjectID");
$SubjectDesc = mysql_result($result,$i,"SubjectDesc");
$Finals = mysql_result($result,$i,"Finals");
?>
<tr>
<td><?php echo $SID; ?></td>
<td><?php echo $SubjectDesc; ?></td>
<td><?php echo $Finals; ?></td>
</tr>
<?php
}
?>
The problem is when I login student2, the grades of student1 will still appear..