seany123 Posted April 1, 2009 Share Posted April 1, 2009 i have two tables which i need to pull values from ones called "players" and it has a all information about the user and (city_id) in it. The other table is called "city" and it has (city_id and city_name) in it what i want to do is when $players->city_id = 1.... for it to echo the name of the city using the (city) table. the last catch is im trying to do a page which shows alot of different peoples "city_name" value... heres the code i already have... <?php /Check for user ID if (!$_GET['id']) { header("Location: members.php"); } else { $query = $db->execute("select `id`, `username`, `city_id` from `players` where `username`=?", array($_GET['id'])); if ($query->recordcount() == 0) { header("Location: members.php"); } else { $profile = $query->fetchrow(); } } ?> now if i set the below code to $player->city_id... then it displays MY city name... but setting it to profile doesnt show anyones. <? $query = $db->execute("select * from `city` where `city_id` like '$profile->city_id'"); $city = $query->fetchrow(); ?> to echo my code: <?=($city['city_name'])?> can anyone give me a hand? Quote Link to comment Share on other sites More sharing options...
fenway Posted April 2, 2009 Share Posted April 2, 2009 Does the query itself return the correct resultset? 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.