I\'m creating a display for a student module webpage that displays in this format
2001/02
I would probably code it like this, probably not the only way but should work based on what I believe you are trying to achieve. Please make sure to add the "order by" to your SQL query as well.
echo "";
$query2 = "SELECT mods.mid, ayr, mtitle, credits FROM stud, smod, mods WHERE stud.sid = '".$_POST['stuNo']."' and stud.sid = smod.sid and smod.mid = mods.mid ORDER BY ayr DESC";
$result = mysql_query($query2) or die(mysql_error());
echo "Enrollment and Progress";
echo "";
echo "Module Selection ";
$year = "";
while ($row = mysql_fetch_array($result)) {
if ($year != $row["ayr"]) {
echo "" . $row["ayr"] . " ";
$year = $row["ayr"];
}
echo "";
echo "" . $row["mid"] . " ";
echo "" . $row["mtitle"] . " ";
echo "" . $row["credits"] . " ";
echo " ";
}
echo "
";
讨论(0)
- 热议问题