tippy_102 Posted October 8, 2006 Share Posted October 8, 2006 My test site was working great until I decided to add a sidebar menu. :(My sidebar menu[code] 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>"; } [/code] My details page[code]$query = "SELECT * from games where Cid='$Cid' ORDER BY 'datetime' DESC";$result = mysql_query($query); [/code] My ProblemWith 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? Quote Link to comment Share on other sites More sharing options...
Oldiesmann Posted October 8, 2006 Share Posted October 8, 2006 $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] Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted October 8, 2006 Author Share Posted October 8, 2006 [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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.