All pastes #162877 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-09-06 22:59 UTC
rendered paste body
<head>
<link rel="stylesheet" href="common/default.css" media="screen" type="text/css">
</head>
<center>
<img src="common/image/logo.jpg">
</center>
<?php
include ("common/connect.php");

if($HTTP_GET_VARS[view] == "year"){

$sql = "SELECT * FROM school_plan_years WHERE `cid` = $_GET[year]";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$year = $row[name];
$yearid = $_GET[year];

$sql = "SELECT * FROM school_plan_subjects ORDER BY sid asc";
$result = mysql_query($sql) or die(mysql_error());

echo"
<font size= \"25\">
Plan for $year
<br>
</font>

<table class=\"funky_border\">
<tr>
<th class=\"funky_border\">
Subjects
</th>
<th class=\"funky_border\">
Term 1
</th>
<th class=\"funky_border\">
Term 2
</th>
<th class=\"funky_border\">
Term 3
</th>
<th class=\"funky_border\">
Term 4

</th>
<th class=\"funky_border\">
Term 5
</th>
<th class=\"funky_border\">
Term 6
</th>
</tr>
";

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
	$termno = "1";
	echo"
		<tr>
		<td valign=\"top\" class=\"funky_border\">
		$row[name]
		</td>
	";
	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"
			    <td class=\"funky_border\">
			        <table>
						<tr>
						<td>
						<b>
						$sql2
						</b>
						</td>
						</tr>
						<tr>
						<td>
						$row2[name]
						</td>
						</tr>
					</table>
				</td>
			";
			$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"
			    <td class=\"funky_border\">
			        <table>
						<tr>
						<td>
						<b>
						CC Link - $sql3
						<br>
						$row3[name]
						</b>
						</td>
						</tr>
						<tr>
						<td>
						$row3[text]
						</td>
						</tr>
					</table>
				</td>
				";
			$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"
			    <td class=\"funky_border\">
			        <table>
						<tr>
						<td>
						<b>
						CC Link - $sql4
						<br>
						$row4[name]
						</b>
						</td>
						</tr>
						<tr>
						<td>
						$row4[text]
						</td>
						</tr>
					</table>
				</td>
				";
			$x = true;				
			};
			
			if ($x == false)
			{
			//if there is nothing in this cell
			    echo "<td>&nbsp;</td>";
			}
					$termno++;
	 	};

echo"
</tr>
";

};
echo"
</table>
";
}else{
//you want to view by term
};