Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-22-2008, 04:29 PM
NickyDee NickyDee is offline
 
Join Date: Aug 2008
Posts: 53
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Running another database within a vBulletin page

I run a website about medical school admissions in the UK. The main shell of the website (http://www.study-medicine.co.uk) is a vBulletin forum. Another part of the website is a statistics database that runs from a seperate mysql database. Until now the way it worked was to have the statistics database outside of the vBulletin shell since they both run on seperate databases, but this means I can't use the navbar/navbits stuff on that part of the website which is a shame, it would also be nice to be able to restrict the database to my users so I can keep track of who is using it.

So I want to stick my stats database into the middle of a vBulletin page.

So heres my basic vBulletin page ready to accept the database.

And heres my stats database ready to be put into the middle of that vBulletin page.

How do I go about getting it to work? When I copy and past the stats database code into the vBulletin page I get an error on the first line.

Thanks for your help.

As a side note iframes are not an options.
Reply With Quote
  #2  
Old 09-25-2008, 03:41 AM
Amenadiel's Avatar
Amenadiel Amenadiel is offline
 
Join Date: Sep 2006
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is the second database running in mysql? It seems to me you have two databases on one mysql server but ¿are the connection strings the same? ¿Do you know if vbulletin's DB user has access to the other DB?

I ask this because once you include global (as in any vb based page) you have the connection already worked out, and if the user has privileges over the second database it might be just a matter of adding dbname before the table query.

Perhaps you just need to rewrite the queries in order for the integration to work.
Reply With Quote
  #3  
Old 09-25-2008, 01:47 PM
NickyDee NickyDee is offline
 
Join Date: Aug 2008
Posts: 53
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi amenadiel,

I have two seperate mysql servers at two seperate physical locations. One has the vBulletin board on it, the other my admissions statistics database. So I have seperate localhost, username, password and dbnames for each mysql database.

I can get it to connect to one database, but not both at the same time. heres it he code I'm using:

Code:
<?php 

error_reporting(E_ALL & ~E_NOTICE); 

define('viewdatabase5', 'viewdb5');  

$phrasegroups = array(); 

$specialtemplates = array(); 

$globaltemplates = array( ); 

$actiontemplates = array(); 

chdir('#########'); 
require_once('./global.php');   

$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude); 

$navbits = array();

$navbits[$parent] = 'Statistics Database'; 

$navbits = construct_navbits($navbits); 
eval('$navbar = "' . fetch_template('navbar') . '";'); 

// including this string below is what causes the issue. viewdb5 is just a copy of whats below as a template. If i include it, i connect only to the vBulletin board. If I exclude it I only connect to the stats board.

eval('print_output("' . fetch_template('viewdb5') . '");');



//this is where i connect to my second database, the stats one.

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>

<br />
$spacer_close
$footer
</body>
</html>
Thanks so much for your help.
Reply With Quote
  #4  
Old 09-26-2008, 07:00 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And the result is 'Error connecting to mysql'?

What happens if you put the connect to the 2nd database in a test script, can it connect or does it fail also?
Reply With Quote
  #5  
Old 09-26-2008, 01:25 PM
NickyDee NickyDee is offline
 
Join Date: Aug 2008
Posts: 53
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can connect to the second database in a test script, infact thats how its working at the moment. But I want to fully integrate it so I can use user permissions and the navbar from vbulletin.

Literally what I need is a page like this:

$Header
$header include
$navbar

-------

$second_database

-------

$footer

I understand that PHP Echo commands (which get used a lot in my stats database) break the vbulletin script, so I tried using my stats database HTML and PHP as a plugin, hooked to global start (with ob_clean etc) and entered as $second_database into the template. but it doesnt work. it just loads the page with the header/navbar and nothing in the middle.

Or perhaps I'm using the wrong hook? Surely global start applies to all files that reference /global.php? even custom ones.
Reply With Quote
  #6  
Old 09-26-2008, 01:59 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And what message do you get when using the full script? If it is empty, then it should have been connected correctly to the second database.

PS I doubt the paramters you use on the mysql_connect are correct, but with the edited out values i can not check this.
Reply With Quote
  #7  
Old 09-26-2008, 02:10 PM
Quarterbore Quarterbore is offline
 
Join Date: Mar 2005
Location: Valley Forge PA
Posts: 538
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I remember seeing a discussion in the past where someone had the same issue and I recall they had to connect to the new database to get the data and then reconect to the vbulletin data to continue on.

I am not sure that this really helps much but I tried to find the thread and here are a few other topics that might help:

https://vborg.vbsupport.ru/showthrea...nnect+database

https://vborg.vbsupport.ru/showthrea...nnect+database

I will have to look more as I recall there was a thread on here that described how to do it but I have not found it.

Good Luck & please share your fix if you find one as I don't have an immediate use but I could find one!
Reply With Quote
  #8  
Old 09-26-2008, 04:23 PM
NickyDee NickyDee is offline
 
Join Date: Aug 2008
Posts: 53
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

my mysql_connect parameters are definately working, you can see it in action at: http://www.study-medicine.co.uk/viewdatabase2.php. 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>
Reply With Quote
  #9  
Old 09-26-2008, 05:55 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Put it in a script and do: Including External Files
Reply With Quote
  #10  
Old 09-26-2008, 06:02 PM
NickyDee NickyDee is offline
 
Join Date: Aug 2008
Posts: 53
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Tried that originally, doesn't seem to work. Just loads the header/include/navbar portion of the page but with no contents. (and no error messages.) I was using global start but perhaps it should use a different one. Which would you use? (template is a custom template if that factors into it).
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:05 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05955 seconds
  • Memory Usage 2,322KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete