Hey everyone, I am having a problem displaying all rows with the same ID. I have two entries in my database with the same ID, but only one is being displayed. I think I need a while loop but I'm not sure how to intigrate one with what I have.
<?
$conn = mysql_connect("localhost","databaseUsername","databasePassword");
$db = mysql_select_db("databaseName");
// takes info from form
$username = $_POST["StuUserID"];
$password = $_POST["StudPassword"];
$result = MYSQL_QUERY("select * from User_Info, GradeBook where User_Info.stuID=GradeBook.stuID AND User_Info.StuID='$username'and User_Info.Password='$password'")
or die ("Name and password not found or not matched");
$worked = mysql_fetch_array($result);
$username = $worked[StuID];
$password = $worked[Password];
$fname = $worked[FirstName];
$lname = $worked[LastName];
$cname = $worked[ClassName];
$glevel = $worked[GradeLevel];
$assign = $worked[Assignment];
$grade = $worked[Grade];
$comments = $worked[Comments];
$dposted = $worked[DatePosted];
if($worked) {
include "header.php";
echo "<br><center>Welcome $fname!</center><br><div align=center>
<center>
<table border=1 cellpadding=0 cellspacing=0 style=border-collapse: collapse bordercolor=#111111 id=AutoNumber1>
<tr>
<td>Class Name</td>
<td>Assignment</td>
<td>Grade</td>
<td>Date Posted</td>
<td>Comments</td>
</tr>
<tr>
<td>$cname</td>
<td>$assign</td>
<td>$grade</td>
<td>$dposted</td>
<td>$comments</td>
</tr>
</table>
</center>
</div><br>";
include "footer.php";
} else {
include "header.php";
echo "<br><br><b><center>Sorry, Name and password not found or not matched</center></b><br><br>";
include "footer.php";
}
?>
Any help is greatly appreciated!