Plan for $year
"; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $termno = "1"; echo" "; while ($termno < "7") { $x = false; //term 1 - main stuff $sql2 = "SELECT * FROM school_plan_resource WHERE sid = '$row[sid]' AND yid = '$yearid' AND tid = '$termno'"; $result2 = mysql_query($sql2) or die(mysql_error()); while ($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) { echo" "; $x = true; }; //term 1 - where subject is CC1 $sql3 = "SELECT * FROM school_plan_resource WHERE cc1 = '$row[sid]' AND yid = '$yearid' AND tid = '$termno'"; $result3 = mysql_query($sql3) or die(mysql_error()); while ($row3 = mysql_fetch_array($ while ($row3 = mysql_fetch_array($result3, MYSQL_ASSOC)) { echo" "; $x = true; }; //term 1 - where subject is CC2 $sql4 = "SELECT * FROM school_plan_resource WHERE cc2 = '$row[sid]' AND yid = '$yearid' AND tid = '$termno'"; $result4 = mysql_query($sql4) or die(mysql_error()); while ($row4 = mysql_fetch_array($result4, MYSQL_ASSOC)) { echo" "; $x = true; }; if ($x == false) { //if there is nothing in this cell echo ""; } $termno++; }; echo" "; }; echo"
Subjects Term 1 Term 2 Term 3 Term 4 Term 5 Term 6
$row[name]
$sql2
$row2[name]
CC Link - $sql3
$row3[name]
$row3[text]
CC Link - $sql4
$row4[name]
$row4[text]
 
"; }else{ //you want to view by term };