seany123 Posted August 1, 2009 Share Posted August 1, 2009 <?php include("lib.php"); define("PAGENAME", "gang Profile"); $player = check_user($secret_key, $db); //Check for user ID if (!$_GET['id']) { header("Location: gang_listing.php"); } else { //Populates $gang variable $query3 = $db->execute("select * from `gangs` where `name`=?", array($_GET['id'])); if ($query3->recordcount() == 0) { header("Location: gang_listing.php"); } else { $gang = $query3->fetchrow(); } } include("templates/private_header3.php"); echo "GANG['NAME']: ".$gang['name'].""; echo "GANG->NAME: ".$gang->name.""; echo "GANG->level: ".$gang->level.""; echo "GANG['level']: ".$gang['level'].""; ?> im trying to retrieve information from the mysql table gangs.. via the gang name... but for some reason it wont echo anything. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 1, 2009 Share Posted August 1, 2009 By "it wont echo anything" do you mean the page is entirely blank? If so, do you have error reporting and display errors turned on? Are you sure you're also not being redirected and it is in fact gang_listing.php that is blank? Quote Link to comment Share on other sites More sharing options...
seany123 Posted August 2, 2009 Author Share Posted August 2, 2009 no the page isnt blank... for example its echoing "GANG['NAME']:" but then not echoing $gang['name'] Quote Link to comment Share on other sites More sharing options...
Bricktop Posted August 2, 2009 Share Posted August 2, 2009 Hi seany123, Try using ' instead of " inside the echo statements. i.e.: Instead of: echo "GANG['NAME']: ".$gang['name'].""; Use: echo "GANG['NAME']: '.$gang['name'].'"; Quote Link to comment Share on other sites More sharing options...
seany123 Posted August 2, 2009 Author Share Posted August 2, 2009 thats just giving me whitespace error. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 2, 2009 Share Posted August 2, 2009 Well without knowing what it is returned by the fetchrow() method, it's a little difficult to help. I'd start by passing $gang to var_dump and see what it contains. Quote Link to comment Share on other sites More sharing options...
seany123 Posted August 3, 2009 Author Share Posted August 3, 2009 what var_dump($gang); ? Quote Link to comment Share on other sites More sharing options...
seany123 Posted August 3, 2009 Author Share Posted August 3, 2009 here is what i get... array(23) { ["id"]=> string(1) "9" ["leader"]=> string(9) "adminsean" ["name"]=> string(5) "admin" ["tag"]=> string(3) "ADM" ["motd"]=> string(0) "" ["price"]=> string(2) "20" ["money"]=> string(1) "0" ["points"]=> string(1) "0" ["blurb"]=> string(0) "" ["level"]=> string(1) "1" ["maxlevel"]=> string(3) "500" ["exp"]=> string(1) "0" ["maxexp"]=> string(1) "0" ["maxmoney"]=> string(9) "250000000" ["member_limit"]=> string(1) "5" ["member_limit_max"]=> string(2) "50" ["description"]=> string(10) "WELL HELLO" ["announcement"]=> string(4) "home" ["tax"]=> string(1) "0" ["banner"]=> string(2) "no" ["bannerurl"]=> string(0) "" ["crime"]=> string(1) "0" ["crime_time"]=> string(1) "0" } but then i changed users and got this: bool(false) Quote Link to comment Share on other sites More sharing options...
TeNDoLLA Posted August 3, 2009 Share Posted August 3, 2009 nothing.. Quote Link to comment Share on other sites More sharing options...
TeNDoLLA Posted August 3, 2009 Share Posted August 3, 2009 Hi seany123, Try using ' instead of " inside the echo statements. i.e.: Use: echo "GANG['NAME']: '.$gang['name'].'"; This should be instead <?php echo 'GANG["NAME"]: '.$gang['name']; Quote Link to comment Share on other sites More sharing options...
seany123 Posted August 3, 2009 Author Share Posted August 3, 2009 Hi seany123, Try using ' instead of " inside the echo statements. i.e.: Use: echo "GANG['NAME']: '.$gang['name'].'"; This should be instead <?php echo 'GANG["NAME"]: '.$gang['name']; that didnt work. Quote Link to comment Share on other sites More sharing options...
seany123 Posted August 4, 2009 Author Share Posted August 4, 2009 i dont understand whats happening. 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.