I am getting this error: Error performing query: Query was empty
using the following:
Form:
<select name="pastseasonpoints">
<option value="season01">Season 01</option>
<option value="season02">Season 02</option>
<option value="season03">Season 03</option>
</select>
Results Page:
PHP Code:
<table class="userstats" border="1" style="width:490px;">
<tr class="userstatstableheader">
<td>Pos.</td><td>Driver</td><td>Pts</td><td>Behind</td><td>Bonus</td><td>Events</td>
<td>Wins</td><td>Poles</td><td>Laps</td><td>Led</td><td>Led%</td><td>Top5</td><td>Top10</td><td>DNS</td><td>DNF</td></tr>
<?php
$db = "hfrl0303_league";
$dbhost = "localhost";
$dbuser = "";
$dbpass = "";
$Host = "localhost";
$User = "";
$Password = "";
$Link = mysql_connect ($dbhost, $dbuser, $dbpass);
if (!$Link)
{
echo "Error: Could not connect to the database. Please try again.";
exit;
}
if (! @mysql_select_db($db) ) {
echo( "Unable to locate the Forum Database at this time." );
exit ();
}
if ($_Request['pastseasonpoints'] == "season01" ) {
$query = "SELECT * FROM season01 ORDER BY Position";
}
elseif ($_Request['pastseasonpoints'] == "season02" ) {
$query = "SELECT * FROM season02 ORDER BY Position";
}
elseif ($_Request['pastseasonpoints'] == "season03" ) {
$query = "SELECT * FROM season03 ORDER BY Position";
}
$result=mysql_query($query, $Link);
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>" );
exit();
}
while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)) {
echo("<tr class=\"userstats\"><td>" . $row["Position"] . "</td>" );
echo("<td>" . $row["Driver"] . "</td>" );
echo("<td>" . $row["Points"] . "</td>" );
echo("<td>" . $row["Points_Behind"] . "</td>" );
echo("<td>" . $row["Bonus"] . "</td>" );
echo("<td>" . $row["Events"] . "</td>" );
echo("<td>" . $row["Wins"] . "</td>" );
echo("<td>" . $row["Poles"] . "</td>" );
echo("<td>" . $row["Laps"] . "</td>" );
echo("<td>" . $row["Led"] . "</td>" );
echo("<td>" . $row["Led_Percent"] . "</td>" );
echo("<td>" . $row["Top5"] . "</td>" );
echo("<td>" . $row["Top10"] . "</td>" );
echo("<td>" . $row["DNS"] . "</td>" );
echo("<td>" . $row["DNF"] . "</td></tr>" );
}
?>
</table>
I used = = this time, no luck. If I use 1 "=" it returns season 01 regardless of the selection made. Any ideas?
Bookmarks