Jump to content


This topic is now archived and is closed to further replies.


details.php?Cid=1 error

Recommended Posts

My test site was working great until I decided to add a sidebar menu.  :(

My sidebar menu

mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM games_names WHERE active = 1 ORDER BY gameName ASC";

$result = mysql_query($sql) or die (mysql_error);

while ($row = mysql_fetch_array($result))
echo "<h1>$gameName $Cid</h1>";
echo "<a href='details.php?Cid=$Cid'>Details</a></br>";


My details page

$query = "SELECT * from games where Cid='$Cid' ORDER BY 'datetime' DESC";
$result = mysql_query($query);

My Problem

With the sidebar menu added, the details page always displays the information for the final Cid shown on the menu.

The page url is correct (ie. details.php?Cid=1 ), but the data returned is always for the final Cid.

What have I done wrong?  How do I ensure the correct Cid is passed?

Share this post

Link to post
Share on other sites
$Cid will only work if you've got register_globals enabled in PHP.

Otherwise you will need to add something like this to your details page:

[code]$Cid = (int) $_GET['Cid'];[/code]

Share this post

Link to post
Share on other sites
[quote author=Oldiesmann link=topic=110898.msg448975#msg448975 date=1160335956]
[code]$Cid = (int) $_GET['Cid'];[/code][/quote]
That's perfect!  8) Thanks a million Oldiesmann!

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.