Now for the part that's really got me puzzled as to why it's not working, the page that the file is included on. Here are the current two files as they stand right now (the one with the include is viewthrilltest.php and the one we've been working on is testing.php)
Viewthrilltest.php
<?php
include "skin_header.php";
$type = "thrillrides";
//CONNECT TO THE DATABASE
$link=mysql_connect('HOST','USERNAME','PASSWORD')
or die('Could not connect: ' . mysql_error());
mysql_select_db('DATABASE') or die('Could not select database');
$id = $_GET['id'] ;
//GET ALL OF THE ENTRIES FROM ONE CATEGORY IN A DIFFERENT ORDER
$result = mysql_query("SELECT * FROM `thrillrides` WHERE `id` = '$id' ");
if (!$result) {
echo mysql_error();
exit;
}
while ($array = mysql_fetch_array($result)) {
extract($array);
}
//DISCONNECT FROM THE DATABASE
mysql_close($link);
?>
<tr>
<td width="100%" height="100%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="5" height="189">
<tr>
<td width="100%" valign="top" height="176" colspan="2">
<p align="center"><font face="Arial" size="3"><b>
<?php echo"$name"; ?>
<br>
<?php echo"</b></font><font face='Arial' size='2'>$opened - $model</font></p>";
echo"<p align='center'><img border='0' src='attractions/thrillrides/$image.gif' width='400' height='300'></p>";
?>
</td>
</tr>
<tr>
<td width="100%" valign="top" colspan="2">
<img border="0" src="images/bar.gif" width="425" height="25">
</td>
</tr>
<tr>
<td width="33%" valign="top">
<?php echo"<font face='Arial' size='2'>$description</font>";
echo"<p align='center'><font face='Arial' size='2'>You must be $heightrequirement to ride this ride</font>";
?>
</td>
<td width="67%" valign="top">
<table border="0" width="100%" cellspacing="0">
<tr>
<td width="100%" colspan="2" bgcolor="#000000">
<table border="0" width="100%" bgcolor="#EF9E20" cellspacing="0" cellpadding="3">
<tr>
<td width="100%">
<p align="center"><font face="Arial"><b>Statistics</b></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="50%"><font face="Arial" size="2">Year
Built:</font></td>
<td width="50%"><font face="Arial" size="2"><?php echo"$opened"; ?></font></td>
</tr>
<?php
if(!$manufacturer) {
}
if ($manufacturer) {
?>
<tr>
<td width="50%"><font face="Arial" size="2">Manufacturer:</font></td>
<td width="50%"><font face="Arial" size="2"><?php echo"$manufacturer"; ?></font></td>
</tr>
<?php
}
if(!$model) {
}
if ($model) {
?>
<tr>
<td width="50%"><font face="Arial" size="2">Model:</font></td>
<td width="50%"><font face="Arial" size="2"><?php echo"$model"; ?></font></td>
</tr>
<?php
}
if(!$height) {
}
if ($height) {
?>
<tr>
<td width="50%"><font face="Arial" size="2">Height:</font></td>
<td width="50%"><font face="Arial" size="2"><?php echo"$height"; ?>
feet</font></td>
</tr>
<?php
}
if(!$speed) {
}
if ($speed) {
?>
<tr>
<td width="50%"><font face="Arial" size="2">Speed:</font></td>
<td width="50%"><font face="Arial" size="2"><?php echo"$speed"; ?>
mph</font></td>
</tr>
<?php
}
if(!$capacity) {
}
if ($capacity) {
?>
<tr>
<td width="50%"><font face="Arial" size="2">Capacity:</font></td>
<td width="50%"><font face="Arial" size="2"><?php echo"$capacity"; ?></font></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<tr>
<td width="100%" valign="top" colspan="2">
<img border="0" src="images/bar.gif" width="425" height="25">
</td>
</tr>
<tr>
<td width="50%" valign="top">
<p align="center"><a href="http://gallery.mirollercoast.com/
<?php
echo $image;
?>
" target="_blank"><img border="0" src="images/photogallery.gif" width="150" height="75"></a>
</td>
<td width="50%" valign="top">
<?php
include "testing.php?id=$id&type=$type";
?>
</td>
<?php
include "skin_footer.php";
?>
Testing.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
<table border='0' width='100%' cellspacing='0' cellpadding='5'>
<tr>
<td width='100%'>
<p align='center'><b><font face='Arial' size='3'><u>Attraction
Rating</u></font></b></td>
</tr>
<tr>
<?php
$id = $_GET['id'] ;
$type = $_GET['type'] ;
$ip = $_SERVER['REMOTE_ADDR'] ;
$link=mysql_connect('HOST','USERNAME','PASSWORD')
or die('Could not connect: ' . mysql_error());
mysql_select_db('DATABASE') or die('Could not select database');
$sql = "SELECT AVG(`atrating`) FROM `rating` WHERE `type` = '$type' AND `attractionid` = '$id' GROUP BY `atrating`";
$result = mysql_query($sql) or die('SQL: ' . $sql . ' Error: ' . mysql_error());
$rows = mysql_num_rows($result);
if($rows == 0)
{
?>
<td width='100%'><p align='center'><font face='Arial' size='2'>This attraction has not yet been rated!</font></td>
<?php
mysql_free_result($result);
}
else
{
$array = mysql_fetch_array($result);
$rating = $array[0];
?>
<td width='100%'><p align='center'><font face='Arial' size='2'>
<?php
echo $rating;
?> out of 10</font></td>
<?php
}
?>
</tr>
<tr>
</tr>
</table>
<br>
<?php
$id = $_GET['id'] ;
$type = $_GET['type'] ;
$ip = $_SERVER['REMOTE_ADDR'] ;
$result = mysql_query("SELECT * FROM `rating` WHERE `ip` = '$ip' AND `attractionid` = '$id' AND `type` = '$type' ");
$rows = mysql_num_rows($result);
if($rows == 0)
{
?>
<form method='POST' action='rate.php'>
<p align='center'><b><u><font face='Arial' size='3'>Your
Rating</font></u></b><font face='Arial' size='2'><br>
</font><select size='1' name='rating'>
<option value='10'>10 - Great</option>
<option value='9'>9</option>
<option value='8'>8</option>
<option value='7'>7</option>
<option value='6'>6</option>
<option value='5'>5 - OK</option>
<option value='4'>4</option>
<option value='3'>3</option>
<option value='2'>2</option>
<option value='1'>1 - Terrible</option>
<input type='hidden' name='ip' value='<?php echo $_SERVER['REMOTE_ADDR'] ?>'>
<input type='hidden' name='attractionid' value='<?php echo $id; ?>'>
<input type='hidden' name='type' value='<?php echo $type; ?>'>
</select><br>
<input type='submit' value='Rate' name='B1'></p>
</form>
<?php
mysql_free_result($result);
}
else
{
?>
<p align='center'><font face='Arial' size='2'>You have already rated this attraction!</font><p align='center'> </p>
<?php
mysql_free_result($result);
}
mysql_close($link);
?>
If you can get this to work I just might love you forever.