Ok, I am trying to develop a CMS for my gaming site, and I am working on the screenshots script. I want to be able to filter out by game platform.
If the user goes to
http://cg3.chaosgaming.com/screenshots.php?platform=xbox&gameid=73
I want them to see the 73rd game in the Xbox category on my website. I have all the content in a MySQL database, and here is the code I tried to write, but does not work.
<p><?include("mysql/connection_info.php");
// open database connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
?> Please Select a Game </p>
<p><?
if ($platform) {
// generate and execute query
$query = "SELECT id, title, content, platform FROM screenshots WHERE platform = '$platform' AND id = '$id'";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// get resultset as object
$row = mysql_fetch_object($result);
// print details
if ($row)
{
}
else {
include(gamelist.php);
}
?>
<?
}
// close database connection
mysql_close($connection);
?>
</p>
It connects to the database fine, and the page loads with the appropriate info shown if the user tries to access the script directly.
Heres my dilemma,
I created a dummy entry in the sql database, with the platform entry in the database as xbox and the id as 1
But, when i go to http://cg3.chaosgaming.com/screenshots.php?platform=xbox&id=1
I still get the same message as if i tried to access the script directly with no URL info.
Any help is appreciated,
Marty
ChaosGaming.com