my mysql_connect parameters are definately working, you can see it in action at:
. But that is made to look like the vbulletin chasis but its entirely outside the database. its just a look-a-like. Ideally I want to use navbar/header etc. and to monitor or even restrict access (e.g. if we have to pay for those statistics later on we may want to make those pages a paid subscription only service).
Thanks quarterbore, I'll have a look at those.
Maybe there is an easier way to ask this question, forget everything I've said first off. What I want to do is insert the following code into a vbulletin page. How do I do it?
Code:
mysql_connect("#########", "#########", "#########") or die('Error connecting to mysql');
mysql_select_db("#########");
if (isset($_GET['SortOrder'])) {
$SortOrder = intval($_GET['SortOrder']);
} else {
$SortOrder = 0;
}
$ch1 = 'unchecked';
$ch2 = 'unchecked';
$ch3 = 'unchecked';
$ch4 = 'unchecked';
$ch5 = 'unchecked';
$ch6 = 'unchecked';
if (isset($_GET['Submit1'])) {
if (isset($_GET['ch1'])) {
$ch1 = $_GET['ch1'];
if ($ch1 == 'a') {
$ch1 = 'checked';
}
}
if (isset($_GET['ch2'])) {
$ch2 = $_GET['ch2'];
if ($ch2 == 'b') {
$ch2 = 'checked';
}
}
if (isset($_GET['ch3'])) {
$ch3 = $_GET['ch3'];
if ($ch3 == 'c') {
$ch3 = 'checked';
}
}
if (isset($_GET['ch4'])) {
$ch4 = $_GET['ch4'];
if ($ch4 == 'd') {
$ch4 = 'checked';
}
}
if (isset($_GET['ch5'])) {
$ch5 = $_GET['ch5'];
if ($ch5 == 'e') {
$ch5 = 'checked';
}
}
if (isset($_GET['ch6'])) {
$ch6 = $_GET['ch6'];
if ($ch6 == 'f') {
$ch6 = 'checked';
}
}
}
$query="SELECT * FROM medical_school WHERE CourseT = 'UG'";
if ($ch1 == checked) { // Order by resits only
$query .= " AND Resits = 'Yes'";
} if ($ch2 == checked) { // Order by clearing only
$query .= " AND Clearing = 'Yes'";
} if ($ch3 == checked) { // Order by biology only
$query .= " AND Biology = '-'";
} if ($ch4 == checked) { // Order by chemistry only
$query .= " AND Chemistry = '-'";
} if ($ch5 == checked) { // Order by ukcat only
$query .= " AND UKCAT = '-'";
} if ($ch6 == checked) { // Order by ukcat only
$query .= " AND Tests = '-'";}
elseif ($SortOrder == '1') { // Order by Applied
$query .= " ORDER BY Applied DESC";
} elseif ($SortOrder == '10') { // Order by Foreign
$query .= " ORDER BY Foreign DESC";
} elseif ($SortOrder == '3') { // Order by APP
$query .= " ORDER BY APP DESC";
} elseif ($SortOrder == '4') { // Order by Accepted
$query .= " ORDER BY Accepted DESC";
} elseif ($SortOrder == '5') { // Order by Applied
$query .= " ORDER BY Applied ASC ";
} elseif ($SortOrder == '6') { // Order by Foreign
$query .= " ORDER BY Foreign ASC";
} elseif ($SortOrder == '7') { // Order by APP
$query .= " ORDER BY APP ASC";
} elseif ($SortOrder == '8') { // Order by Accepted
$query .= " ORDER BY Accepted ASC";
} elseif ($SortOrder == '9') { // Order by Name
$query .= " ORDER BY Name DESC";
} else { // Default, alphabetical
$query .= " ORDER BY Name ASC";
}
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>Statistics Database</title>
<if condition="$show['inlinemod']"><script type="text/javascript" src="clientscript/vbulletin_inlinemod.js?v=$vboptions[simpleversion]"></script></if>
</head>
<body>
$header
$navbar
$spacer_open
<table width="930" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" align="left" valign="top"><strong><font face="Arial, Helvetica, sans-serif" size="4">Table View </font></strong><font face="Arial, Helvetica, sans-serif" size="2">(click on an entry name to bring up the detailed view)</font><strong><br />
<font size="3" face="Arial, Helvetica, sans-serif"><br />
Advanced Filter Options:</font></strong>
</td>
</tr>
</table>
<form name="form1" method="GET" action="viewdatabase2.php">
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="250" align="left" valign="top">
<p><font size="2" face="Arial, Helvetica, sans-serif">Show courses that accept:</font><br />
<input type = "Checkbox" Name ="ch1" value ="a" <?PHP print $ch1; ?>>
<font size="2" face="Arial, Helvetica, sans-serif">Resits</font> <br />
<input type = "Checkbox" Name ="ch2" value ="b" <?PHP print $ch2; ?>>
<font size="2" face="Arial, Helvetica, sans-serif">Clearing</font> </p>
</td>
<td width="250" align="left" valign="top"><font size="2" face="Arial, Helvetica, sans-serif">Show courses that do not request:</font><br />
<input type = "Checkbox" Name ="ch3" value ="c" <?PHP print $ch3; ?>>
<font size="2" face="Arial, Helvetica, sans-serif">Biology</font> <br />
<input type = "Checkbox" Name ="ch4" value ="d" <?PHP print $ch4; ?>>
<font size="2" face="Arial, Helvetica, sans-serif">Chemistry</font> </td><td width="250" align="left" valign="top">
<font size="2" face="Arial, Helvetica, sans-serif">Show courses that do not use the:</font><br />
<input type = "Checkbox" Name ="ch5" value ="e" <?PHP print $ch5; ?>>
<font size="2" face="Arial, Helvetica, sans-serif">UKCAT</font> <br />
<input type = "Checkbox" Name ="ch6" value ="f" <?PHP print $ch6; ?>>
<font size="2" face="Arial, Helvetica, sans-serif">BMAT</font> <br />
<br />
<input type = "Submit" name = "Submit1" value = "Submit" />
<br /></td>
</tr>
</table>
</form>
<br />
<table border="0" cellspacing="1" cellpadding="0" bgcolor="#000000" align="center">
<tr>
<td>
<table border="0" cellspacing="1" cellpadding="4" align="center" bgcolor="#FFFFFF">
<tr>
<td width="150" rowspan="2" align="center" valign="middle" bgcolor="#698193"><font face="Arial, Helvetica, sans-serif" size="2" color="white"><strong>Name </strong></font><font face="Arial, Helvetica, sans-serif" size="1" color="white">(click for details)</font> <a href="/viewdatabase2.php"><img src="/images2/desc.gif" width="7" height="7" border="0" /></a><a href="/viewdatabase2.php?SortOrder=9"><img src="/images2/ASC.gif" width="7" height="7" border="0" /></a></td>
<td colspan="4" align="center" bgcolor="#698193"><font face="Arial, Helvetica, sans-serif" size="2" color="white"><strong>Admissions</strong></font></td>
<td colspan="3" align="center" bgcolor="#698193"><font face="Arial, Helvetica, sans-serif" size="2" color="white"><strong>A-Level Subjects</strong></font></td>
<td colspan="2" align="center" bgcolor="#698193"><font face="Arial, Helvetica, sans-serif" size="2" color="white"><strong>Tests</strong></font></td>
<td colspan="2" align="center" bgcolor="#698193"><font color="white" size="2" face="Arial, Helvetica, sans-serif"><strong>Entry Types</strong></font></td>
</tr>
<tr>
<td width="65" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">Applied </font><a href="/viewdatabase2.php?SortOrder=1"><img src="/images2/desc.gif" width="7" height="7" border="0" /></a><a href="/viewdatabase2.php?SortOrder=5"><img src="/images2/ASC.gif" width="7" height="7" border="0" /></a></td>
<td width="65" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">Foreign </font><a href="/viewdatabase2.php?SortOrder=10"><img src="/images2/desc.gif" width="7" height="7" border="0" /></a><a href="/viewdatabase2.php?SortOrder=6"><img src="/images2/ASC.gif" width="7" height="7" border="0" /></a></td>
<td width="65" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">APP </font><a href="/viewdatabase2.php?SortOrder=3"><img src="/images2/desc.gif" width="7" height="7" border="0" /></a><a href="/viewdatabase2.php?SortOrder=7"><img src="/images2/ASC.gif" width="7" height="7" border="0" /></a></td>
<td width="65" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">Places </font><a href="/viewdatabase2.php?SortOrder=4"><img src="/images2/desc.gif" width="7" height="7" border="0" /></a><a href="/viewdatabase2.php?SortOrder=8"><img src="/images2/ASC.gif" width="7" height="7" border="0" /></a></td>
<td width="35" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">Grades</font></td>
<td width="35" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">Chem</font></td>
<td width="35" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">Bio</font></td>
<td width="50" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">UKCAT</font></td>
<td width="50" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">Tests</font></td>
<td width="40" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">Resits</font></td>
<td width="40" align="center" bgcolor="#7e94a4"><font face="Arial, Helvetica, sans-serif" size="2" color="white">Clearing</font></td>
</tr>
<?
$i=0;
while ($i < $num) {
$Name=mysql_result($result,$i,"Name");
$Applied=mysql_result($result,$i,"Applied");
$Foreign=mysql_result($result,$i,"Foreign");
$APP=mysql_result($result,$i,"APP");
$Accepted=mysql_result($result,$i,"Accepted");
$Biology=mysql_result($result,$i,"Biology");
$Chemistry=mysql_result($result,$i,"Chemistry");
$Grades=mysql_result($result,$i,"Other");
$UKCAT=mysql_result($result,$i,"UKCAT");
$Test=mysql_result($result,$i,"Tests");
$Resits=mysql_result($result,$i,"Resits");
$Clearing=mysql_result($result,$i,"Clearing");
$ID=mysql_result($result,$i,"ID");
?>
<tr>
<td height="35" bgcolor="#cddde8" align="left"><font face="Arial, Helvetica, sans-serif" size="2"><a href="/details.php?det=<? echo $ID; ?>"><? echo $Name; ?></a></font></td>
<td bgcolor="#cde8cd" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $Applied; ?></font></td>
<td bgcolor="#cde8cd" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $Foreign; ?></font></td>
<td bgcolor="#cde8cd" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $APP; ?></font></td>
<td bgcolor="#cde8cd" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $Accepted; ?></font></td>
<td bgcolor="#cde8de" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $Grades; ?></font></td>
<td bgcolor="#cde8de" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $Chemistry; ?></font></td>
<td bgcolor="#cde8de" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $Biology; ?></font></td>
<td bgcolor="#e6cde8" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $UKCAT; ?></font></td>
<td bgcolor="#e6cde8" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $Test; ?></font></td>
<td bgcolor="#e6cde8" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $Resits; ?></font></td>
<td bgcolor="#e6cde8" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><? echo $Clearing; ?></font></td>
</tr>
<?
$i++;
}
echo "</table>";
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<br/>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" align="left" valign="top"><p><strong><font size="2" face="Arial, Helvetica, sans-serif">Please Note: </font></strong><font size="2" face="Arial, Helvetica, sans-serif">While we go to great lengths to ensure our information is accurate and up to date, given the large number of statistics it is inevitable that sometimes we may be behind or incorrect. If you believe you have a more up to date figure please contact us at <a href="mailto:help@study-medicine.co.uk">help@study-medicine.co.uk</a> asap.</font></p>
<p><font size="2" face="Arial, Helvetica, sans-serif">All information shown here has been gathered by study-medicine. If you wish to reproduce this information elsewhere please link back to this site.</font></p>
</td>
</tr>
</table>