Jump to content


Photo

details.php?Cid=1 error


  • Please log in to reply
2 replies to this topic

#1 tippy_102

tippy_102
  • Members
  • PipPipPip
  • Advanced Member
  • 446 posts

Posted 08 October 2006 - 07:15 PM

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))
	{
		extract($row);
		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?
Fur is more actively protested than leather 'cause its easier to harrass rich women than biker gangs.

#2 Oldiesmann

Oldiesmann
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • LocationCincinnati, Ohio

Posted 08 October 2006 - 07:32 PM

$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:

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

The Oldiesmann
SMF Project Manager
SMF+Gallery2 - Beta3.1 now available

#3 tippy_102

tippy_102
  • Members
  • PipPipPip
  • Advanced Member
  • 446 posts

Posted 08 October 2006 - 07:37 PM

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

That's perfect!  8) Thanks a million Oldiesmann!

Fur is more actively protested than leather 'cause its easier to harrass rich women than biker gangs.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users