<?include_once($_SERVER['DOCUMENT_ROOT']."/gew2011/settings.php");?>
<center>
<?
	switch($_REQUEST['mode']){
		case "1":
			$title = "Total Signups";
			$SQL = "SELECT * FROM tbl_registrants_test WHERE registrant_attendance='Yes' AND registrant_replaced='0' ORDER BY registrant_firstname;";
			break;
		case "2":
			$title = "Total Turnups";
			$SQL = "SELECT a.* FROM tbl_registrants_test as a, tbl_registrant_attendance as b WHERE a.registrant_id=b.registrant_id ORDER BY a.registrant_firstname;";
			break;
		case "3":
			$title = "Total Tour Indication";
			$SQL = "SELECT * FROM tbl_registrants_test WHERE registrant_attendance='Yes' AND registrant_replaced='0' AND registrant_tour='Attending Tour' ORDER BY registrant_firstname;";
			break;
		case "4":
			$title = "Total Tour";
			$SQL = "SELECT a.* FROM tbl_registrants_test as a, tbl_registrant_attendance as b WHERE a.registrant_attendance='Yes' AND a.registrant_replaced='0' AND a.registrant_tour='Attending Tour' AND a.registrant_id=b.registrant_id ORDER BY a.registrant_firstname;";
			break;
		case "5":
			$title = "Offshore & Marine Engineering Indication";
			$SQL = "SELECT * FROM tbl_registrants_test WHERE registrant_attendance='Yes' AND registrant_replaced='0' AND registrant_first='Offshore & Marine Engineering' ORDER BY registrant_firstname;";
			break;
		case "6":
			$title = "Offshore & Marine Engineering";
			$SQL = "SELECT a.* FROM tbl_registrants_test as a, tbl_registrant_attendance as b WHERE a.registrant_attendance='Yes' AND a.registrant_replaced='0' AND a.registrant_first='Offshore & Marine Engineering' AND a.registrant_id=b.registrant_id ORDER BY a.registrant_firstname;";
			break;
		case "7":
			$title = "Port Shipping Indication";
			$SQL = "SELECT * FROM tbl_registrants_test WHERE registrant_attendance='Yes' AND registrant_replaced='0' AND registrant_first='Port Shipping' ORDER BY registrant_firstname;";
			break;
		case "8":
			$title = "Port Shipping";
			$SQL = "SELECT a.* as number FROM tbl_registrants_test as a, tbl_registrant_attendance as b WHERE a.registrant_attendance='Yes' AND a.registrant_replaced='0' AND a.registrant_first='Port Shipping' AND a.registrant_id=b.registrant_id ORDER BY a.registrant_firstname;";
			break;
		case "9":
			$title = "Maritime Services Indication";
			$SQL = "SELECT * FROM tbl_registrants_test WHERE registrant_attendance='Yes' AND registrant_replaced='0' AND registrant_first='Maritime Services' ORDER BY registrant_firstname;";
			break;
		case "10":
			$title = "Maritime Services";
			$SQL = "SELECT a.* FROM tbl_registrants_test as a, tbl_registrant_attendance as b WHERE a.registrant_attendance='Yes' AND a.registrant_replaced='0' AND a.registrant_first='Maritime Services' AND a.registrant_id=b.registrant_id ORDER BY a.registrant_firstname;";
			break;
	}
	$results=$qry->queryMultiSelect($SQL);
	
	$i=0;
	$output="<table style='font-family:verdana;font-size:12px;width:550px;background:#CCCCFF;border:1px solid #000099;padding:3px;border-collapse: collapse;'><tr><td colspan='3' align='center' bgcolor='#FFFFFF'><b>$title</b></td></tr><tr><td style='border:1px solid #000099;padding:3px;'><b>First Name, Last Name</b></td><td style='border:1px solid #000099;padding:3px;' align='center'><b>Office Number</b></td><td align='center' style='border:1px solid #000099;padding:3px;'><b>Institue/Organisation</b></td></tr>";
	foreach ($results as $result){
		$i++;
		$output.="<tr><td style='border:1px solid #000099;padding:3px;'>".$result['registrant_firstname'].",".$result['registrant_lastname']."</td><td style='border:1px solid #000099;padding:3px;' align='center'>".$result['registrant_officenumber']."</td><td align='center' style='border:1px solid #000099;padding:3px;'>".$result['registrant_institute']."</td></tr>";
	}
	if ($i==0)
		echo "<tr><td colspan='3' align='center'><font color='red'>There are no records found.</font></td></tr>";
	else
		echo $output;
?>
</center>