The Easiest Way to Save and Share Code Snippets on the web

College Media ad rates output

abap

last edit: Jan, 14th 2011 | jump to bottom

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="lab10.css" rel="stylesheet" type="text/css">
</head>
 
<body>
 
<?php 
 
 
	//connect to the mysql server
	$connection = mysql_connect("localhost", "database", "databasepassword") or die ("Failure to connect to database");
	mysql_select_db("database", $connection);
 
	if ($connection===FALSE)
	{
		echo "<p>Connection Failed</p>";
 
	}
	else
	{
 
	$SQLStringAv1 = "SELECT AVG(TotalPixels) AS PixAvg FROM uniadrates";
 
	$SQLStringAverageTotals = "SELECT CEILING(AVG(TotalPixels)), ROUND(AVG(MonthlyRate), 2), ROUND(AVG(WeeklyRate), 2), ROUND(AVG(DailyRate), 2), ROUND(AVG(CPM), 2), ROUND(AVG(SemesterRate), 2), ROUND(AVG(SchoolYearRate), 2), ROUND(AVG(SummerRate), 2), ROUND(AVG(CalYearRate), 2) FROM uniadrates";
 
	$SQLStringAveragePixels = "SELECT CEILING(AVG(TotalPixels)) FROM uniadrates WHERE TotalPixels>1";
	$SQLStringAverageMonthly = "SELECT ROUND(AVG(MonthlyRate), 2) FROM  uniadrates WHERE MonthlyRate>1";
	$SQLStringAverageWeekly = "SELECT ROUND(AVG(WeeklyRate), 2) FROM uniadrates WHERE WeeklyRate>1";
	$SQLStringAverageDaily = "SELECT ROUND(AVG(DailyRate), 2) FROM uniadrates WHERE DailyRate>1";
	$SQLStringAverageCPM = "SELECT ROUND(AVG(CPM), 2) FROM uniadrates WHERE CPM>1";
	$SQLStringAverageSemester = "SELECT ROUND(AVG(SemesterRate), 2) FROM uniadrates WHERE SemesterRate>1";
	$SQLStringAverageSchoolYear = "SELECT ROUND(AVG(SchoolYearRate), 2) FROM uniadrates WHERE SchoolYearRate>1";
	$SQLStringAverageSummer = "SELECT ROUND(AVG(SummerRate), 2) FROM uniadrates WHERE SummerRate>1";
	$SQLStringAverageCalYear = "SELECT ROUND(AVG(CalYearRate), 2) FROM uniadrates WHERE CalYearRate>1";
 
	$SQLStringAv2 = "SELECT width, Dimensions, ROUND(AVG(MonthlyRate), 2), MIN(MonthlyRate), MAX(MonthlyRate) AS AvgMonthlyRate FROM uniadrates WHERE width>1 AND MonthlyRate>1 GROUP BY Dimensions";
	$SQLStringAv3 = "SELECT width, Dimensions, ROUND(AVG(WeeklyRate), 2), MIN(WeeklyRate), MAX(WeeklyRate) FROM uniadrates WHERE width>1 AND WeeklyRate>1 GROUP BY Dimensions";
	$SQLStringAv4 = "SELECT width, Dimensions, ROUND(AVG(DailyRate), 2), MIN(DailyRate), MAX(DailyRate) FROM uniadrates WHERE width>1 AND DailyRate>1 GROUP BY Dimensions";
	$SQLStringAv5 = "SELECT width, Dimensions, ROUND(AVG(CPM), 2), MIN(CPM), MAX(CPM) FROM uniadrates WHERE width>1 AND CPM>1 GROUP BY Dimensions";
	$SQLStringAv6 = "SELECT width, Dimensions, ROUND(AVG(SemesterRate), 2), MIN(SemesterRate), MAX(SemesterRate) FROM uniadrates WHERE width>1 AND SemesterRate>1 GROUP BY Dimensions";
	$SQLStringAv7 = "SELECT width, Dimensions, ROUND(AVG(SchoolYearRate), 2), MIN(SchoolYearRate), MAX(SchoolYearRate) FROM uniadrates WHERE width>1 AND SchoolYearRate>1 GROUP BY Dimensions";
	$SQLStringAv8 = "SELECT width, Dimensions, ROUND(AVG(SummerRate), 2), MIN(SummerRate), MAX(SummerRate) FROM uniadrates WHERE width>1 AND SummerRate>1 GROUP BY Dimensions";
	$SQLStringAv9 = "SELECT width, Dimensions, ROUND(AVG(CalYearRate), 2), MIN(CalYearRate), MAX(CalYearRate) FROM uniadrates WHERE width>1 AND CalYearRate>1 GROUP BY Dimensions";
	$SQLStringAdTypes = "SELECT Ad_Type FROM uniadrates WHERE Notes NOT LIKE '%Package%' GROUP BY Ad_Type";
	$SQLStringPackages = "SELECT Ad_Type FROM uniadrates WHERE Notes LIKE '%Package%' GROUP BY Ad_Type";
 
	$SQLString10 = "SELECT Ad_Type, width, 
		ROUND(AVG(MonthlyRate), 2), MIN(MonthlyRate), MAX(MonthlyRate), 
		ROUND(AVG(WeeklyRate), 2), MIN(WeeklyRate), MAX(WeeklyRate), 
		ROUND(AVG(DailyRate), 2), MIN(DailyRate), MAX(DailyRate), 
		ROUND(AVG(CPM), 2), MIN(CPM), MAX(CPM), 
		ROUND(AVG(SemesterRate), 2), MIN(SemesterRate), MAX(SemesterRate), 
		ROUND(AVG(SchoolYearRate), 2), MIN(SchoolYearRate), MAX(SchoolYearRate), 
		ROUND(AVG(SummerRate), 2), MIN(SummerRate), MAX(SummerRate), 
		ROUND(AVG(CalYearRate), 2), MIN(CalYearRate), MAX(CalYearRate) 
			FROM uniadrates WHERE width<1 AND Notes NOT LIKE '%Package%' GROUP BY Ad_Type";	
 
	$SQLString11 = "SELECT University FROM uniadrates GROUP BY University";
	$SQLStringNoRates = "SELECT * FROM uniadrates WHERE Notes LIKE '%No%' GROUP BY pubName";
	$SQLStringNoAds = "SELECT * FROM uniadrates WHERE Notes LIKE '%No ads%' GROUP BY pubName";
	$SQLStringDimensions = "SELECT Dimensions FROM uniadrates GROUP BY Dimensions";
 
	$SQLStringLevelPubs = "SELECT University, pubName FROM uniadrates WHERE Ad_level != '' AND Ad_level NOT LIKE '%ith%' AND Notes NOT LIKE '%Package%' GROUP BY pubName";
	$SQLStringEmailPubs = "SELECT University, pubName, Ad_Type FROM uniadrates WHERE Ad_level LIKE '%Email%' GROUP BY pubName";
	$SQLStringMobilePubs = "SELECT University, pubName, Ad_Type, Ad_level FROM uniadrates WHERE Ad_level LIKE '%Mobile%' GROUP BY pubName";
	$SQLStringVideoPubs = "SELECT * FROM uniadrates WHERE Ad_level LIKE '%Video%'";
	$SQLStringAudioPubs = "SELECT * FROM uniadrates WHERE Ad_level LIKE '%Audio%'";
 
	$SQLStringPubsWithMonthlyRates = "SELECT * FROM uniadrates WHERE MonthlyRate > 1 GROUP BY pubName";
	$countingSQLPubsWithMonthlyRates = mysql_query($SQLStringPubsWithMonthlyRates, $connection);
	$PubsWithMonthlyRates = mysql_num_rows($countingSQLPubsWithMonthlyRates);
 
 
	$SQLStringMedRec = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Medium Rectangle' GROUP BY pubName";
		$SQLStringMedRecD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '300x250' GROUP BY pubName";
		$SQLStringMedRecM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '300x250' AND Ad_Type LIKE 'Medium Rectangle' GROUP BY pubName";
	$countingSQLMedRec = mysql_query($SQLStringMedRec, $connection);
		$countingSQLMedRecD = mysql_query($SQLStringMedRecD, $connection);
		$countingSQLMedRecM = mysql_query($SQLStringMedRecM, $connection);
	$PubsWithMedRec = mysql_num_rows($countingSQLMedRec);
		$PubsWithMedRecD = mysql_num_rows($countingSQLMedRecD);
		$PubsWithMedRecM = mysql_num_rows($countingSQLMedRecM);
 
	$SQLStringSq = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Square' GROUP BY pubName";
		$SQLStringSqD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '250x250' GROUP BY pubName";
		$SQLStringSqM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '250x250' AND Ad_Type LIKE 'Square' GROUP BY pubName";
	$countingSQLSq = mysql_query($SQLStringSq, $connection);
		$countingSQLSqD = mysql_query($SQLStringSqD, $connection);
		$countingSQLSqM = mysql_query($SQLStringSqM, $connection);
	$PubsWithSq = mysql_num_rows($countingSQLSq);
		$PubsWithSqD = mysql_num_rows($countingSQLSqD);
		$PubsWithSqM = mysql_num_rows($countingSQLSqM);
 
 
	$SQLStringVertRec = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Vertical Rectangle' GROUP BY pubName";
		$SQLStringVertRecD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '240x400' GROUP BY pubName";
		$SQLStringVertRecM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '240x400' AND Ad_Type LIKE 'Vertical Rectangle' GROUP BY pubName";
	$countingSQLVertRec = mysql_query($SQLStringVertRec, $connection);
		$countingSQLVertRecD = mysql_query($SQLStringVertRecD, $connection);
		$countingSQLVertRecM = mysql_query($SQLStringVertRecM, $connection);
	$PubsWithVertRec = mysql_num_rows($countingSQLVertRec);
		$PubsWithVertRecD = mysql_num_rows($countingSQLVertRecD);
		$PubsWithVertRecM = mysql_num_rows($countingSQLVertRecM);
 
 
	$SQLStringLarRec = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Large Rectangle' GROUP BY pubName";
		$SQLStringLarRecD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '336x280' GROUP BY pubName";
		$SQLStringLarRecM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '336x280' AND Ad_Type LIKE 'Large Rectangle' GROUP BY pubName";
	$countingSQLLarRec = mysql_query($SQLStringLarRec, $connection);
		$countingSQLLarRecD = mysql_query($SQLStringLarRecD, $connection);
		$countingSQLLarRecM = mysql_query($SQLStringLarRecM, $connection);
	$PubsWithLarRec = mysql_num_rows($countingSQLLarRec);
		$PubsWithLarRecD = mysql_num_rows($countingSQLLarRecD);
		$PubsWithLarRecM = mysql_num_rows($countingSQLLarRecM);
 
 
	$SQLStringRec = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Rectangle' GROUP BY pubName";
		$SQLStringRecD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '180x150' GROUP BY pubName";
		$SQLStringRecM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '180x150' AND Ad_Type LIKE 'Rectangle' GROUP BY pubName";
	$countingSQLRec = mysql_query($SQLStringRec, $connection);
		$countingSQLRecD = mysql_query($SQLStringRecD, $connection);
		$countingSQLRecM = mysql_query($SQLStringRecM, $connection);
	$PubsWithRec = mysql_num_rows($countingSQLRec);
		$PubsWithRecD = mysql_num_rows($countingSQLRecD);
		$PubsWithRecM = mysql_num_rows($countingSQLRecM);
 
 
	$SQLString31Rec = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE '3:1 Rectangle' GROUP BY pubName";
		$SQLString31RecD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '300x100' GROUP BY pubName";
		$SQLString31RecM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '300x100' AND Ad_Type LIKE '3:1 Rectangle' GROUP BY pubName";
	$countingSQL31Rec = mysql_query($SQLString31Rec, $connection);
		$countingSQL31RecD = mysql_query($SQLString31RecD, $connection);
		$countingSQL31RecM = mysql_query($SQLString31RecM, $connection);
	$PubsWith31Rec = mysql_num_rows($countingSQL31Rec);
		$PubsWith31RecD = mysql_num_rows($countingSQL31RecD);
		$PubsWith31RecM = mysql_num_rows($countingSQL31RecM);
 
	$SQLStringPopUnder = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Pop-Under' GROUP BY pubName";
		$SQLStringPopUnderD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '720x300' GROUP BY pubName";
		$SQLStringPopUnderM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '720x300' AND Ad_Type LIKE 'Pop-Under' GROUP BY pubName";
	$countingSQLPopUnder = mysql_query($SQLStringPopUnder, $connection);
		$countingSQLPopUnderD = mysql_query($SQLStringPopUnderD, $connection);
		$countingSQLPopUnderM = mysql_query($SQLStringPopUnderM, $connection);
	$PubsWithPopUnder = mysql_num_rows($countingSQLPopUnder);
		$PubsWithPopUnderD = mysql_num_rows($countingSQLPopUnderD);
		$PubsWithPopUnderM = mysql_num_rows($countingSQLPopUnderM);
 
 
 
	$SQLStringFullBan = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Full Banner' GROUP BY pubName";
		$SQLStringFullBanD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '468x60' GROUP BY pubName";
		$SQLStringFullBanM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '468x60' AND Ad_Type LIKE 'Full Banner' GROUP BY pubName";
	$countingSQLFullBan = mysql_query($SQLStringFullBan, $connection);
		$countingSQLFullBanD = mysql_query($SQLStringFullBanD, $connection);
		$countingSQLFullBanM = mysql_query($SQLStringFullBanM, $connection);
	$PubsWithFullBan = mysql_num_rows($countingSQLFullBan);
		$PubsWithFullBanD = mysql_num_rows($countingSQLFullBanD);
		$PubsWithFullBanM = mysql_num_rows($countingSQLFullBanM);
 
 
	$SQLStringHalfBan = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Half Banner' GROUP BY pubName";
		$SQLStringHalfBanD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '234x60' GROUP BY pubName";
		$SQLStringHalfBanM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '234x60' AND Ad_Type LIKE 'Half Banner' GROUP BY pubName";
	$countingSQLHalfBan = mysql_query($SQLStringHalfBan, $connection);
		$countingSQLHalfBanD = mysql_query($SQLStringHalfBanD, $connection);
		$countingSQLHalfBanM = mysql_query($SQLStringHalfBanM, $connection);
	$PubsWithHalfBan = mysql_num_rows($countingSQLHalfBan);
		$PubsWithHalfBanD = mysql_num_rows($countingSQLHalfBanD);
		$PubsWithHalfBanM = mysql_num_rows($countingSQLHalfBanM);
 
	$SQLStringMicroBar = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Micro Bar' GROUP BY pubName";
		$SQLStringMicroBarD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '88x31' GROUP BY pubName";	
		$SQLStringMicroBarM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '88x31' AND Ad_Type LIKE 'Micro Bar' GROUP BY pubName";
	$countingSQLMicroBar = mysql_query($SQLStringMicroBar, $connection);
		$countingSQLMicroBarD = mysql_query($SQLStringMicroBarD, $connection);
		$countingSQLMicroBarM = mysql_query($SQLStringMicroBarM, $connection);
	$PubsWithMicroBar = mysql_num_rows($countingSQLMicroBar);
		$PubsWithMicroBarD = mysql_num_rows($countingSQLMicroBarD);
		$PubsWithMicroBarM = mysql_num_rows($countingSQLMicroBarM);
 
	$SQLStringButton = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Button' GROUP BY pubName";
		$SQLStringButton1D = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '120x90' GROUP BY pubName";
		$SQLStringButton1M = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '120x90' AND Ad_Type LIKE 'Button' GROUP BY pubName";
		$SQLStringButton2D = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '120x60' GROUP BY pubName";
		$SQLStringButton2M = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '120x60' AND Ad_Type LIKE 'Button' GROUP BY pubName";
	$countingSQLButton = mysql_query($SQLStringButton, $connection);
		$countingSQLButton1D = mysql_query($SQLStringButton1D, $connection);
		$countingSQLButton1M = mysql_query($SQLStringButton1M, $connection);
		$countingSQLButton2D = mysql_query($SQLStringButton2D, $connection);
		$countingSQLButton2M = mysql_query($SQLStringButton2M, $connection);
	$PubsWithButton = mysql_num_rows($countingSQLButton);
		$PubsWithButton1D = mysql_num_rows($countingSQLButton1D);
		$PubsWithButton1M = mysql_num_rows($countingSQLButton1M);
		$PubsWithButton2D = mysql_num_rows($countingSQLButton2D);
		$PubsWithButton2M = mysql_num_rows($countingSQLButton2M);
 
 
	$SQLStringVertBan = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Vertical Banner' GROUP BY pubName";
		$SQLStringVertBanD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '120x240' GROUP BY pubName";
		$SQLStringVertBanM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '120x240' AND Ad_Type LIKE 'Vertical Banner' GROUP BY pubName";
	$countingSQLVertBan = mysql_query($SQLStringVertBan, $connection);
		$countingSQLVertBanD = mysql_query($SQLStringVertBanD, $connection);
		$countingSQLVertBanM = mysql_query($SQLStringVertBanM, $connection);
	$PubsWithVertBan = mysql_num_rows($countingSQLVertBan);
		$PubsWithVertBanD = mysql_num_rows($countingSQLVertBanD);
		$PubsWithVertBanM = mysql_num_rows($countingSQLVertBanM);
 
 
	$SQLStringSqButton = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Square Button' GROUP BY pubName";
		$SQLStringSqButtonD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '125x125' GROUP BY pubName";
		$SQLStringSqButtonM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '125x125' AND Ad_Type LIKE 'Square Button' GROUP BY pubName";
	$countingSQLSqButton = mysql_query($SQLStringSqButton, $connection);
		$countingSQLSqButtonD = mysql_query($SQLStringSqButtonD, $connection);
		$countingSQLSqButtonM = mysql_query($SQLStringSqButtonM, $connection);
	$PubsWithSqButton = mysql_num_rows($countingSQLSqButton);
		$PubsWithSqButtonD = mysql_num_rows($countingSQLSqButtonD);
		$PubsWithSqButtonM = mysql_num_rows($countingSQLSqButtonM);
 
 
	$SQLStringLead = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Leaderboard' GROUP BY pubName";
		$SQLStringLeadD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '728x90' GROUP BY pubName";
		$SQLStringLeadM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '728x90' AND Ad_Type LIKE 'Leaderboard' GROUP BY pubName";
	$countingSQLLead = mysql_query($SQLStringLead, $connection);
		$countingSQLLeadD = mysql_query($SQLStringLeadD, $connection);
		$countingSQLLeadM = mysql_query($SQLStringLeadM, $connection);
	$PubsWithLead = mysql_num_rows($countingSQLLead);
		$PubsWithLeadD = mysql_num_rows($countingSQLLeadD);
		$PubsWithLeadM = mysql_num_rows($countingSQLLeadM);
 
 
	$SQLStringWideSky = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Wide Skyscraper' GROUP BY pubName";
		$SQLStringWideSkyD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '160x600' GROUP BY pubName";
		$SQLStringWideSkyM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '160x600' AND Ad_Type LIKE 'Wide Skyscraper' GROUP BY pubName";
	$countingSQLWideSky = mysql_query($SQLStringWideSky, $connection);
		$countingSQLWideSkyD = mysql_query($SQLStringWideSkyD, $connection);
		$countingSQLWideSkyM = mysql_query($SQLStringWideSkyM, $connection);
	$PubsWithWideSky = mysql_num_rows($countingSQLWideSky);
		$PubsWithWideSkyD = mysql_num_rows($countingSQLWideSkyD);
		$PubsWithWideSkyM = mysql_num_rows($countingSQLWideSkyM);
 
 
	$SQLStringSky = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Skyscraper' GROUP BY pubName";
		$SQLStringSkyD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '120x600' GROUP BY pubName";
		$SQLStringSkyM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '120x600' AND Ad_Type LIKE 'Skyscraper' GROUP BY pubName";
	$countingSQLSky = mysql_query($SQLStringSky, $connection);
		$countingSQLSkyD = mysql_query($SQLStringSkyD, $connection);
		$countingSQLSkyM = mysql_query($SQLStringSkyM, $connection);
	$PubsWithSky = mysql_num_rows($countingSQLSky);
		$PubsWithSkyD = mysql_num_rows($countingSQLSkyD);
		$PubsWithSkyM = mysql_num_rows($countingSQLSkyM);
 
 
	$SQLStringHalfPage = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Ad_Type LIKE 'Half Page%' GROUP BY pubName";
		$SQLStringHalfPageD = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '300x600' GROUP BY pubName";
		$SQLStringHalfPageM = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE Dimensions LIKE '300x600' AND Ad_Type LIKE 'Half Page%' GROUP BY pubName";
	$countingSQLHalfPage = mysql_query($SQLStringHalfPage, $connection);
		$countingSQLHalfPageD = mysql_query($SQLStringHalfPageD, $connection);
		$countingSQLHalfPageM = mysql_query($SQLStringHalfPageM, $connection);
	$PubsWithHalfPage = mysql_num_rows($countingSQLHalfPage);
		$PubsWithHalfPageD = mysql_num_rows($countingSQLHalfPageD);
		$PubsWithHalfPageM = mysql_num_rows($countingSQLHalfPageM);
 
 
	$SQLStringIABTerms = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE 
		Ad_Type LIKE 'Medium Rectangle' 
			OR  Ad_Type LIKE 'Half Page%' 
			OR Ad_Type LIKE 'Skyscraper' 
			OR Ad_Type LIKE 'Wide Skyscraper' 
			OR Ad_Type LIKE 'Leaderboard'
			OR Ad_Type LIKE 'Square Button'
			OR Ad_Type LIKE 'Vertical Banner'
			OR Ad_Type LIKE 'Button'
			OR Ad_Type LIKE 'Micro Bar'
			OR Ad_Type LIKE 'Half Banner'
			OR Ad_Type LIKE 'Full Banner'
			OR Ad_Type LIKE 'Pop-Under'
			OR Ad_Type LIKE '3:1 Rectangle'
			OR Ad_Type LIKE 'Rectangle'
			OR Ad_Type LIKE 'Large Rectangle'
			OR Ad_Type LIKE 'Vertical Rectangle'
			OR Ad_Type LIKE 'Square'
			OR Ad_Type LIKE 'Medium Rectangle'
		GROUP BY pubName";
 
	$countingSQLIABTerms = mysql_query($SQLStringIABTerms, $connection);
	$PubsWithIABTerms = mysql_num_rows($countingSQLIABTerms);
 
	$SQLStringIABDimensions = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE 
		Dimensions LIKE '250x250' 
			OR Dimensions LIKE '300x250'
			OR Dimensions LIKE '240x400'
			OR Dimensions LIKE '336x280' 
			OR Dimensions LIKE '180x150'
			OR Dimensions LIKE '300x100'
			OR Dimensions LIKE '720x300'
			OR Dimensions LIKE '468x60'
			OR Dimensions LIKE '234x60'
			OR Dimensions LIKE '88x31'
			OR Dimensions LIKE '120x90'
			OR Dimensions LIKE '120x60'
			OR Dimensions LIKE '120x240'
			OR Dimensions LIKE '125x125'
			OR Dimensions LIKE '728x90'
			OR Dimensions LIKE '160x600'
			OR Dimensions LIKE '120x600'
			OR Dimensions LIKE '300x600'
		GROUP BY pubName";
 
	$countingSQLIABDimensions = mysql_query($SQLStringIABDimensions, $connection);
	$PubsWithIABDimensions = mysql_num_rows($countingSQLIABDimensions);
 
 
	$SQLStringIABStuff = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE 
		Ad_Type LIKE 'Medium Rectangle' 
			OR  Ad_Type LIKE 'Half Page%' 
			OR Ad_Type LIKE 'Skyscraper' 
			OR Ad_Type LIKE 'Wide Skyscraper' 
			OR Ad_Type LIKE 'Leaderboard'
			OR Ad_Type LIKE 'Square Button'
			OR Ad_Type LIKE 'Vertical Banner'
			OR Ad_Type LIKE 'Button'
			OR Ad_Type LIKE 'Micro Bar'
			OR Ad_Type LIKE 'Half Banner'
			OR Ad_Type LIKE 'Full Banner'
			OR Ad_Type LIKE 'Pop-Under'
			OR Ad_Type LIKE '3:1 Rectangle'
			OR Ad_Type LIKE 'Rectangle'
			OR Ad_Type LIKE 'Large Rectangle'
			OR Ad_Type LIKE 'Vertical Rectangle'
			OR Ad_Type LIKE 'Square'
			OR Ad_Type LIKE 'Medium Rectangle'
			AND
			Dimensions LIKE '250x250' 
			OR Dimensions LIKE '300x250'
			OR Dimensions LIKE '240x400'
			OR Dimensions LIKE '336x280' 
			OR Dimensions LIKE '180x150'
			OR Dimensions LIKE '300x100'
			OR Dimensions LIKE '720x300'
			OR Dimensions LIKE '468x60'
			OR Dimensions LIKE '234x60'
			OR Dimensions LIKE '88x31'
			OR Dimensions LIKE '120x90'
			OR Dimensions LIKE '120x60'
			OR Dimensions LIKE '120x240'
			OR Dimensions LIKE '125x125'
			OR Dimensions LIKE '728x90'
			OR Dimensions LIKE '160x600'
			OR Dimensions LIKE '120x600'
			OR Dimensions LIKE '300x600'
		GROUP BY pubName";
 
	$countingSQLIABStuff = mysql_query($SQLStringIABStuff, $connection);
	$PubsWithIABStuff = mysql_num_rows($countingSQLIABStuff);
 
	$SQLStringIABCorrect = "SELECT pubName, University, Ad_Type, Dimensions FROM uniadrates WHERE 
		Ad_Type LIKE 'Medium Rectangle' 
			OR Ad_Type LIKE 'Half Page%' AND Dimensions LIKE '300x600'
			OR Ad_Type LIKE 'Skyscraper' AND Dimensions LIKE '120x600'
			OR Ad_Type LIKE 'Wide Skyscraper' AND Dimensions LIKE '160x600'
			OR Ad_Type LIKE 'Leaderboard' AND Dimensions LIKE '728x90'
			OR Ad_Type LIKE 'Square Button' AND Dimensions LIKE '125x125'
			OR Ad_Type LIKE 'Vertical Banner' AND Dimensions LIKE '120x240'
			OR Ad_Type LIKE 'Button' AND Dimensions LIKE '120x60'
			OR Ad_Type LIKE 'Button' AND Dimensions LIKE '120x90'
			OR Ad_Type LIKE 'Micro Bar' AND Dimensions LIKE '88x31'
			OR Ad_Type LIKE 'Half Banner' AND Dimensions LIKE '234x60'
			OR Ad_Type LIKE 'Full Banner' AND Dimensions LIKE '468x60'
			OR Ad_Type LIKE 'Pop-Under' AND Dimensions LIKE '720x300'
			OR Ad_Type LIKE '3:1 Rectangle' AND Dimensions LIKE '300x100'
			OR Ad_Type LIKE 'Rectangle' AND Dimensions LIKE '180x150'
			OR Ad_Type LIKE 'Large Rectangle' AND Dimensions LIKE '336x280'
			OR Ad_Type LIKE 'Vertical Rectangle' AND Dimensions LIKE '240x400'
			OR Ad_Type LIKE 'Square' AND Dimensions LIKE '250x250'
			OR Ad_Type LIKE 'Medium Rectangle' AND Dimensions LIKE '300x250' 
		GROUP BY pubName"; 
 
	$countingSQLIABCorrect = mysql_query($SQLStringIABCorrect, $connection);
	$PubsWithIABCorrect = mysql_num_rows($countingSQLIABCorrect);	
 
 
//SELECT * FROM uniadrates WHERE Notes LIKE '%listed%' AND Notes NOT LIKE '%No ads%' GROUP BY pubName
 
//	$countingROS = 1 ;
 
	$countingSQL11 = mysql_query($SQLString11, $connection);
	$SQLString12 = "SELECT pubName FROM uniadrates GROUP BY pubName";
	$countingSQL12 = mysql_query($SQLString12, $connection);
	$countingSQL13 = mysql_query($SQLStringAdTypes, $connection);
	$countingSQL14 = mysql_query($SQLStringPackages, $connection);
	$SQLStringLevels = "SELECT Ad_level FROM uniadrates WHERE Ad_level NOT LIKE '%ith%' AND Notes NOT LIKE '%Package%' GROUP BY Ad_level";
	$countingSQL15 = mysql_query($SQLStringLevels, $connection);
	$countingSQLNoRates = mysql_query($SQLStringNoRates, $connection);
	$countingSQLNoAds = mysql_query($SQLStringNoAds, $connection);
	$countingSQLDimensions = mysql_query($SQLStringDimensions, $connection);
	$countingSQLLevelPubs = mysql_query($SQLStringLevelPubs, $connection);
	$countingSQLEmailPubs = mysql_query($SQLStringEmailPubs, $connection);
	$countingSQLMobilePubs = mysql_query($SQLStringMobilePubs, $connection);
	$countingSQLVideoPubs = mysql_query($SQLStringVideoPubs, $connection);
	$countingSQLAudioPubs = mysql_query($SQLStringAudioPubs, $connection);
 
 
 
	$AdTypeCount = mysql_num_rows($countingSQL13);
	$PackageTypeCount = mysql_num_rows($countingSQL14);
	$UniCount = mysql_num_rows($countingSQL11);
	$PubCount = mysql_num_rows($countingSQL12);
	$AdLevelCount = mysql_num_rows($countingSQL15);
	$noRatesCount = mysql_num_rows($countingSQLNoRates);
	$noAdsCount = mysql_num_rows($countingSQLNoAds);
	$AdDimensionsCount = mysql_num_rows($countingSQLDimensions);
	$PubsWithLevels = mysql_num_rows($countingSQLLevelPubs);
	$PubsWithEmails = mysql_num_rows($countingSQLEmailPubs);
	$PubsWithMobile = mysql_num_rows($countingSQLMobilePubs);
	$PubsWithVideo = mysql_num_rows($countingSQLVideoPubs);
	$PubsWithAudio = mysql_num_rows($countingSQLAudioPubs);
	$PubsWithMedRec = mysql_num_rows($countingSQLMedRec);
 
	$noRatesSum = $noRatesCount - $noAdsCount;
 
	$PubsWithAds = $PubCount - $noAdsCount;
	$PubsWithoutLevels = $PubsWithAds - $PubsWithLevels;
	$AvgPixels = 0;
	$AvgMonthlyRate = 0;
 
			$resultPx = mysql_query($SQLStringAveragePixels, $connection);
			while($arow = mysql_fetch_array($resultPx, MYSQL_NUM)){
				$AvgPixels = intval($arow[0]);
			}
 
			$resultMonth = mysql_query($SQLStringAverageMonthly, $connection);
			while(($arow = mysql_fetch_array($resultMonth, MYSQL_NUM))){
				$AvgMonthlyRate = intval($arow[0]);
 
			}
 
 
 
	echo "<br />Universities Surveyed: $UniCount<br />";
	echo "Publications Surveyed: $PubCount<br />";
	echo "Ad Types: $AdTypeCount<br />";
	echo "Package Types: $PackageTypeCount<br />";
	echo "Ad Level Types: $AdLevelCount<br />";	
	echo "Dimensions supplied: $AdDimensionsCount<br />";
	echo "Total number of Publications with Ads: $PubsWithAds <br />";
	echo "Student Publications that either do not have ads or do not list rates online: $noRatesCount <br />";
	echo "Student Publications that do not sell online ads: $noAdsCount <br />";
	echo "Student Publications that have rates but do not display them online: $noRatesSum <br />";
	echo "Publications that designate ad placement options: $PubsWithLevels<br />";
	echo "Publications that do not designate ad placement: $PubsWithoutLevels<br />";
	echo "Publications that offer advertising placement in email newsletters: $PubsWithEmails<br />";
	echo "Publications that offer mobile advertising: $PubsWithMobile<br />";
	echo "Publications that offer video ads: $PubsWithVideo<br />";
	echo "Publications that offer audio ads: $PubsWithAudio<br />";
	$PxPerDollar=ceil(($AvgPixels/$AvgMonthlyRate));
	echo "About $PxPerDollar Pixels per $1 a Month<br /><br />";
	echo "Publications that offer montly rates: $PubsWithMonthlyRates<br /><br />";
 
	echo "<a href='http://www.iab.net/iab_products_and_industry_services/508676/508767/Ad_Unit' target='_new'>Standard Interactive Marketing Units as designated by the Interactive Advertising Bureau.</a><br />";
	echo "Publications that use IAB Names: $PubsWithIABTerms<br />";
	echo "Publications that use IAB Dimensions: $PubsWithIABDimensions<br />";
	echo "Publications that use IAB Dimensions and Names: $PubsWithIABStuff<br />";
	echo "Publications that use IAB Dimensions and Names correctly: $PubsWithIABCorrect<br />";
	echo "<br />";
	echo "Publications that use the term Medium Rectangle: $PubsWithMedRec<br />";
	echo "Publications that use the IAB Medium Rectangle Dimensions: $PubsWithMedRecD<br />";
	echo "Publications that use the term Medium Rectangle correctly: $PubsWithMedRecM<br /><br />";
 
	echo "Publications that use the term Square: $PubsWithSq<br />";
	echo "Publications that use the IAB Square Dimensions: $PubsWithSqD<br />";
	echo "Publications that use the term Square correctly: $PubsWithSqM<br /><br />";
 
	echo "Publications that use the term Vertical Rectangle: $PubsWithVertRec<br />";
	echo "Publications that use the IAB Vertical Rectangle Dimensions: $PubsWithVertRecD<br />";
	echo "Publications that use the term Vertical Rectangle correctly: $PubsWithVertRecM<br /><br />";
 
	echo "Publications that use the term Large Rectangle: $PubsWithLarRec<br />";
	echo "Publications that use the IAB Large Rectangle Dimensions: $PubsWithLarRecD<br />";
	echo "Publications that use the term Large Rectangle correctly: $PubsWithLarRecM<br /><br />";
 
		echo "Publications that use the term Rectangle: $PubsWithRec<br />";
	echo "Publications that use the IAB Rectangle Dimensions: $PubsWithRecD<br />";
	echo "Publications that use the term Rectangle correctly: $PubsWithRecM<br /><br />";
 
		echo "Publications that use the term 3:1 Rectangle: $PubsWith31Rec<br />";
	echo "Publications that use the IAB 3:1 Rectangle Dimensions: $PubsWith31RecD<br />";
	echo "Publications that use the term 3:1 Rectangle correctly: $PubsWith31RecM<br /><br />";
 
	echo "Publications that use the term Pop Under: $PubsWithPopUnder<br />";
	echo "Publications that use the IAB Pop Under Dimensions: $PubsWithPopUnderD<br />";
	echo "Publications that use the term Pop Under correctly: $PubsWithPopUnderM<br /><br />";
 
		echo "Publications that use the term Full Banner: $PubsWithFullBan<br />";
	echo "Publications that use the IAB Full Banner Dimensions: $PubsWithFullBanD<br />";
	echo "Publications that use the term Full Banner correctly: $PubsWithFullBanM<br /><br />";
 
		echo "Publications that use the term Half Banner: $PubsWithHalfBan<br />";
	echo "Publications that use the IAB Half Banner Dimensions: $PubsWithHalfBanD<br />";
	echo "Publications that use the term Half Banner correctly: $PubsWithHalfBanM<br /><br />";
 
		echo "Publications that use the term Micro Bar: $PubsWithMicroBar<br />";
	echo "Publications that use the IAB Micro Bar Dimensions: $PubsWithMicroBarD<br />";
	echo "Publications that use the term Micro Bar correctly: $PubsWithMicroBarM<br /><br />";
 
		echo "Publications that use the term Button: $PubsWithButton<br />";
	echo "Publications that use the IAB Button 1 Dimensions: $PubsWithButton1D<br />";
	echo "Publications that use the term Button with Button 1 Dimensions: $PubsWithButton1M<br />";
	echo "Publications that use the IAB Button 2 Dimensions: $PubsWithButton2D<br />";
	echo "Publications that use the term Button with Button 2 Dimensions: $PubsWithButton2M<br /><br />";
 
 
		echo "Publications that use the term Vertical Banner: $PubsWithVertBan<br />";
	echo "Publications that use the IAB Vertical Banner Dimensions: $PubsWithVertBanD<br />";
	echo "Publications that use the term Vertical Banner correctly: $PubsWithVertBanM<br /><br />";
 
		echo "Publications that use the term Square Button: $PubsWithSqButton<br />";
	echo "Publications that use the IAB Square Button Dimensions: $PubsWithSqButtonD<br />";
	echo "Publications that use the term Square Button correctly: $PubsWithSqButtonM<br /><br />";
 
		echo "Publications that use the term Leaderboard: $PubsWithLead<br />";
	echo "Publications that use the IAB Leaderboard Dimensions: $PubsWithLeadD<br />";
	echo "Publications that use the term Leaderboard correctly: $PubsWithLeadM<br /><br />";
 
		echo "Publications that use the term Wide Skyscraper: $PubsWithWideSky<br />";
	echo "Publications that use the IAB Wide Skyscraper Dimensions: $PubsWithWideSkyD<br />";
	echo "Publications that use the term Wide Skyscraper correctly: $PubsWithWideSkyM<br /><br />";
 
		echo "Publications that use the term Skyscraper: $PubsWithSky<br />";
	echo "Publications that use the IAB Skyscraper Dimensions: $PubsWithSkyD<br />";
	echo "Publications that use the term Skyscraper correctly: $PubsWithSkyM<br /><br />";
 
		echo "Publications that use the term Half Page Ad: $PubsWithHalfPage<br />";
	echo "Publications that use the IAB Half Page Ad Dimensions: $PubsWithHalfPageD<br />";
	echo "Publications that use the term Half Page Ad correctly: $PubsWithHalfPageM<br /><br />";
 
 
 
	echo "<br /><br />";
 
	$result11 = mysql_query($SQLString11, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Count</th>";
			echo "<th>Universities Surveyed</th>";
			echo "</tr>";
			$c=0;			
		while(($row = mysql_fetch_row($result11)) !== FALSE){
			$c++;
			echo "<tr>";
			echo "<td>$c</td>";
			echo "<td>{$row[0]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
	$result2 = mysql_query($SQLStringAverageTotals, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Average Pixels</th>";
			echo "<th>Average Monthly Rate</th>";
			echo "<th>Average Weekly Rate</th>";
			echo "<th>Average Daily Rate</th>";
			echo "<th>Average CPM</th>";
			echo "<th>Average Semester Rate</th>";
			echo "<th>Average School Year Rate</th>";
			echo "<th>Average Summer Rate</th>";
			echo "<th>Average Cal. Year Rate</th>";			
			echo "</tr>";			
		while(($row = mysql_fetch_row($result2)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";
			echo "<td>{$row[1]} </td>";
			echo "<td>{$row[2]} </td>";
			echo "<td>{$row[3]} </td>";
			echo "<td>{$row[4]} </td>";
			echo "<td>{$row[5]} </td>";
			echo "<td>{$row[6]} </td>";
			echo "<td>{$row[7]} </td>";
			echo "<td>{$row[8]} </td>";			
			echo "</tr>";
 
		}
 
			echo "</table><br />";
 
 
			echo "Not including 0 values:<br />";
 
 
		$resultPx = mysql_query($SQLStringAveragePixels, $connection);
			echo "<table width='25%'>";
			echo "<tr>";
			echo "<th>Average Pixels</th>";	
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultPx)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";		
			echo "</tr>";
 
		}
 
			echo "</table><br />";
 
 
		$resultMonth = mysql_query($SQLStringAverageMonthly, $connection);
			echo "<table width='25%'>";
			echo "<tr>";
			echo "<th>Average Monthly Rate</th>";
 
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultMonth)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";
 
			echo "</tr>";
 
		}
 
			echo "</table><br />";
 
 
 
		$resultWeek = mysql_query($SQLStringAverageWeekly, $connection);
			echo "<table width='25%'>";
			echo "<tr>";
			echo "<th>Average Weekly Rate</th>";	
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultWeek)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";		
			echo "</tr>";
 
		}
 
			echo "</table><br />";
 
 
 
		$resultDay = mysql_query($SQLStringAverageDaily, $connection);
			echo "<table width='25%'>";
			echo "<tr>";
			echo "<th>Average Daily Rate</th>";	
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultDay)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";		
			echo "</tr>";
 
		}
 
			echo "</table><br />";
 
 
		$resultCPM = mysql_query($SQLStringAverageCPM, $connection);
			echo "<table width='25%'>";
			echo "<tr>";
			echo "<th>Average CPM</th>";	
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultCPM)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";		
			echo "</tr>";
 
		}
 
			echo "</table><br />";
 
 
		$resultSemester = mysql_query($SQLStringAverageSemester, $connection);
			echo "<table width='25%'>";
			echo "<tr>";
			echo "<th>Average Semester Rate</th>";	
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultSemester)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";		
			echo "</tr>";
 
		}
 
			echo "</table><br />";
 
 
 
		$resultSY = mysql_query($SQLStringAverageSchoolYear, $connection);
			echo "<table width='25%'>";
			echo "<tr>";
			echo "<th>Average School Year Rate</th>";	
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultSY)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";		
			echo "</tr>";
 
		}
 
			echo "</table><br />";
 
 
 
		$resultSummer = mysql_query($SQLStringAverageSummer, $connection);
			echo "<table width='25%'>";
			echo "<tr>";
			echo "<th>Average Summer Rate</th>";	
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultSummer)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";		
			echo "</tr>";
 
		}
 
			echo "</table><br />";
 
 
 
			$resultCalYear = mysql_query($SQLStringAverageCalYear, $connection);
			echo "<table width='25%'>";
			echo "<tr>";
			echo "<th>Average Cal. Year Rates</th>";	
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultCalYear)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";		
			echo "</tr>";
 
		}
 
			echo "</table><br />";
 
 
 
 
 
	//generate table. 
	$result = mysql_query($SQLStringAv2, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Dimensions</th>";
			echo "<th>Publications Using</th>";
			echo "<th>Avg Monthly Rate</th>";
			echo "<th>Minimum Monthly Rate</th>";
			echo "<th>Maximum Monthly Rate</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($result)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[1]} </td>";
			$SQLStringRateUseCount = "SELECT pubName, Dimensions, MonthlyRate FROM uniadrates WHERE Dimensions LIKE '" . $row[1] . "' AND MonthlyRate > 1 GROUP BY pubName";
			$countingSQLRateUseCount = mysql_query($SQLStringRateUseCount, $connection);
			$monthRateCount = mysql_num_rows($countingSQLRateUseCount);
			echo "<td>$monthRateCount</td>";
			echo "<td>{$row[2]}</td>";
			echo "<td>{$row[3]} </td>";
			echo "<td>{$row[4]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
 
		//generate table. 
	$result3 = mysql_query($SQLStringAv3, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Dimensions</th>";
			echo "<th>Publications Using</th>";
			echo "<th>Avg Weekly Rate</th>";
			echo "<th>Minimum Weekly Rate</th>";
			echo "<th>Maximum Weekly Rate</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($result3)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[1]} </td>";
			$SQLStringRateUseCount = "SELECT pubName, Dimensions FROM uniadrates WHERE Dimensions LIKE '" . $row[1] . "' AND WeeklyRate > 1 GROUP BY pubName";
			$countingSQLRateUseCount = mysql_query($SQLStringRateUseCount, $connection);
			$weekRateCount = mysql_num_rows($countingSQLRateUseCount);
			echo "<td>$weekRateCount</td>";			
			echo "<td>{$row[2]}</td>";
			echo "<td>{$row[3]} </td>";
			echo "<td>{$row[4]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
	$result4 = mysql_query($SQLStringAv4, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Dimensions</th>";
			echo "<th>Publications Using</th>";
			echo "<th>Avg Daily Rate</th>";
			echo "<th>Minimum Daily Rate</th>";
			echo "<th>Maximum Daily Rate</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($result4)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[1]} </td>";
			$SQLStringRateUseCount = "SELECT pubName, Dimensions FROM uniadrates WHERE Dimensions LIKE '" . $row[1] . "' AND DailyRate > 1 GROUP BY pubName";
			$countingSQLRateUseCount = mysql_query($SQLStringRateUseCount, $connection);
			$dayRateCount = mysql_num_rows($countingSQLRateUseCount);	
			echo "<td>$dayRateCount</td>";						
			echo "<td>{$row[2]}</td>";
			echo "<td>{$row[3]} </td>";
			echo "<td>{$row[4]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
		$result5 = mysql_query($SQLStringAv5, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Dimensions</th>";
			echo "<th>Publications Using</th>";			
			echo "<th>Avg CPM</th>";
			echo "<th>Minimum CPM</th>";
			echo "<th>Maximum CPM</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($result5)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[1]} </td>";
			$SQLStringRateUseCount = "SELECT pubName, Dimensions FROM uniadrates WHERE Dimensions LIKE '" . $row[1] . "' AND CPM > 1 GROUP BY pubName";
			$countingSQLRateUseCount = mysql_query($SQLStringRateUseCount, $connection);
			$CPMRateCount = mysql_num_rows($countingSQLRateUseCount);	
			echo "<td>$CPMRateCount</td>";				
			echo "<td>{$row[2]}</td>";
			echo "<td>{$row[3]} </td>";
			echo "<td>{$row[4]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
		$result6 = mysql_query($SQLStringAv6, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Dimensions</th>";
			echo "<th>Publications Using</th>";				
			echo "<th>Avg Semester Rate</th>";
			echo "<th>Minimum Semester Rate</th>";
			echo "<th>Maximum Semester Rate</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($result6)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[1]} </td>";
			$SQLStringRateUseCount = "SELECT pubName, Dimensions FROM uniadrates WHERE Dimensions LIKE '" . $row[1] . "' AND SemesterRate > 1 GROUP BY pubName";
			$countingSQLRateUseCount = mysql_query($SQLStringRateUseCount, $connection);
			$SemesterRateCount = mysql_num_rows($countingSQLRateUseCount);	
			echo "<td>$SemesterRateCount</td>";				
			echo "<td>{$row[2]}</td>";
			echo "<td>{$row[3]} </td>";
			echo "<td>{$row[4]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";	
 
 
	$result7 = mysql_query($SQLStringAv7, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Dimensions</th>";
			echo "<th>Publications Using</th>";							
			echo "<th>Avg School Year Rate</th>";
			echo "<th>Minimum School Year Rate</th>";
			echo "<th>Maximum School Year Rate</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($result7)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[1]} </td>";
			$SQLStringRateUseCount = "SELECT pubName, Dimensions FROM uniadrates WHERE Dimensions LIKE '" . $row[1] . "' AND SchoolYearRate > 1 GROUP BY pubName";
			$countingSQLRateUseCount = mysql_query($SQLStringRateUseCount, $connection);
			$SchoolRateCount = mysql_num_rows($countingSQLRateUseCount);	
			echo "<td>$SchoolRateCount</td>";				
			echo "<td>{$row[2]}</td>";
			echo "<td>{$row[3]} </td>";
			echo "<td>{$row[4]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
	$result8 = mysql_query($SQLStringAv8, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Dimensions</th>";
			echo "<th>Publications Using</th>";										
			echo "<th>Avg Summer Rate</th>";
			echo "<th>Minimum Summer Rate</th>";
			echo "<th>Maximum Summer Rate</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($result8)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[1]} </td>";
			$SQLStringRateUseCount = "SELECT pubName, Dimensions FROM uniadrates WHERE Dimensions LIKE '" . $row[1] . "' AND SummerRate > 1 GROUP BY pubName";
			$countingSQLRateUseCount = mysql_query($SQLStringRateUseCount, $connection);
			$SummerRateCount = mysql_num_rows($countingSQLRateUseCount);	
			echo "<td>$SummerRateCount</td>";							
			echo "<td>{$row[2]}</td>";
			echo "<td>{$row[3]} </td>";
			echo "<td>{$row[4]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";			
 
 
	$result9 = mysql_query($SQLStringAv9, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Dimensions</th>";
			echo "<th>Publications Using</th>";				
			echo "<th>Avg Cal. Year Rate</th>";
			echo "<th>Minimum Cal. Year Rate</th>";
			echo "<th>Maximum Cal. Year Rate</th>";
			echo "</tr>";			
	while(($row = mysql_fetch_row($result9)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[1]} </td>";
			$SQLStringRateUseCount = "SELECT pubName, Dimensions FROM uniadrates WHERE Dimensions LIKE '" . $row[1] . "' AND CalYearRate > 1 GROUP BY pubName";
			$countingSQLRateUseCount = mysql_query($SQLStringRateUseCount, $connection);
			$CalYearRateCount = mysql_num_rows($countingSQLRateUseCount);	
			echo "<td>$CalYearRateCount</td>";				
			echo "<td>{$row[2]}</td>";
			echo "<td>{$row[3]} </td>";
			echo "<td>{$row[4]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
	$resultAdTypes = mysql_query($SQLStringAdTypes, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Ad Types</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultAdTypes)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
			echo "</table><br /><br />";
 
	$resultAdDimensions = mysql_query($SQLStringDimensions, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Available Ad Dimensions</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultAdDimensions)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
 
	$resultPackages = mysql_query($SQLStringPackages, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Package Types</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultPackages)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
	$resultAdLevels = mysql_query($SQLStringLevels, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Ad Levels</th>";
			echo "</tr>";			
		while(($row = mysql_fetch_row($resultAdLevels)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
 
	echo "<h3>Ad types with no dimensions supplied</h3>";		
	$result10 = mysql_query($SQLString10, $connection);
			echo "<table>";
			echo "<tr>";
			echo "<th>Ad Type</th>";
			echo "<th>Publications Using</th>";				
			echo "<th>Avg Monthly Rate</th>";
			echo "<th>Minimum Monthly Rate</th>";
			echo "<th>Maximum Monthly Rate</th>";	
			echo "<th>Avg Weekly Rate</th>";
			echo "<th>Minimum Weekly Rate</th>";
			echo "<th>Maximum Weekly Rate</th>";
			echo "<th>Avg Daily Rate</th>";
			echo "<th>Minimum Daily Rate</th>";
			echo "<th>Maximum Daily Rate</th>";
			echo "<th>Avg CPM</th>";
			echo "<th>Minimum CPM</th>";
			echo "<th>Maximum CPM</th>";
			echo "<th>Avg Semester Rate</th>";
			echo "<th>Minimum Semester Rate</th>";
			echo "<th>Maximum Semester Rate</th>";
			echo "<th>Avg School Year Rate</th>";
			echo "<th>Minimum School Year Rate</th>";
			echo "<th>Maximum School Year Rate</th>";
			echo "<th>Avg Summer Rate</th>";
			echo "<th>Minimum Summer Rate</th>";
			echo "<th>Maximum Summer Rate</th>";
			echo "<th>Avg Cal. Year Rate</th>";
			echo "<th>Minimum Cal. Year Rate</th>";
			echo "<th>Maximum Cal. Year Rate</th>";
			echo "</tr>";			
	while(($row = mysql_fetch_row($result10)) !== FALSE){
			echo "<tr>";
			echo "<td>{$row[0]} </td>";
			$SQLStringRateUseCount = "SELECT pubName, Dimensions FROM uniadrates WHERE Ad_Type LIKE '" . $row[0] . "' AND TotalPixels = '0' GROUP BY pubName";
			$countingSQLRateUseCount = mysql_query($SQLStringRateUseCount, $connection);
			$OtherRateCount = mysql_num_rows($countingSQLRateUseCount);	
			echo "<td>$OtherRateCount</td>";			
			echo "<td>{$row[2]}</td>";
			echo "<td>{$row[3]} </td>";
			echo "<td>{$row[4]} </td>";
			echo "<td>{$row[5]} </td>";
			echo "<td>{$row[6]} </td>";
			echo "<td>{$row[7]} </td>";
			echo "<td>{$row[8]} </td>";
			echo "<td>{$row[9]} </td>";
			echo "<td>{$row[10]} </td>";			
			echo "<td>{$row[11]} </td>";
			echo "<td>{$row[12]} </td>";
			echo "<td>{$row[13]} </td>";
			echo "<td>{$row[14]} </td>";
			echo "<td>{$row[15]} </td>";
			echo "<td>{$row[16]} </td>";
			echo "<td>{$row[17]} </td>";
			echo "<td>{$row[18]} </td>";
			echo "<td>{$row[19]} </td>";
			echo "<td>{$row[20]} </td>";
			echo "<td>{$row[21]} </td>";
			echo "<td>{$row[22]} </td>";
			echo "<td>{$row[23]} </td>";
			echo "<td>{$row[24]} </td>";
			echo "<td>{$row[25]} </td>";
 
			echo "</tr>";
 
		}
 
			echo "</table><br /><br />";
 
 
	}
 
	mysql_close($connection);
 
?>
<br />
 
 
 
</body>
</html>
16 views