badurek Posted April 29, 2013 Share Posted April 29, 2013 hi guys, someone can help me to show the name of the city where user are, in side panel thx and sorry for bad english Quote Link to comment Share on other sites More sharing options...
MNG Posted April 29, 2013 Share Posted April 29, 2013 Umm not sure if im right but try this to start off. $location = $result["cityname"]; $location = $result["cityname"]; Quote Link to comment Share on other sites More sharing options...
badurek Posted April 29, 2013 Author Share Posted April 29, 2013 <b>Name:</b> $gn{$u} $d<br /> <b>Money:</b> {$fm}<br /> <b>City:</b> {$ir['location']}<br /> <b>Level:</b> {$ir['level']}<br /> <b>Crystals:</b> {$ir['crystals']}<br /> i tried this, but show me the ID of the city, if possible make location=cityname but location is on the users table and cityname in cities table i dont know how make this, im newbie Quote Link to comment Share on other sites More sharing options...
Serin Posted April 29, 2013 Share Posted April 29, 2013 well it shows in veiw user as <td>Location</td> <td>{$r['cityname']} [<a href='travel.php'>Travel</a>]</td> </tr> so you should just be able to add that in to the side bar and remove the travel link Quote Link to comment Share on other sites More sharing options...
badurek Posted April 29, 2013 Author Share Posted April 29, 2013 well it shows in veiw user as <td>Location</td> <td>{$r['cityname']} [<a href='travel.php'>Travel</a>]</td> </tr> so you should just be able to add that in to the side bar and remove the travel link i tried this but dont show me nothing Quote Link to comment Share on other sites More sharing options...
Serin Posted April 29, 2013 Share Posted April 29, 2013 try {$ir['cityname']} that should work Quote Link to comment Share on other sites More sharing options...
badurek Posted April 29, 2013 Author Share Posted April 29, 2013 try {$ir['cityname']} that should work dont show me nothing :/ Quote Link to comment Share on other sites More sharing options...
badurek Posted April 29, 2013 Author Share Posted April 29, 2013 Edit this to fit into your template. $sql = "SELECT `cityname` FROM `cities` WHERE `cityid` = '{$ir['location']}'"; $run = mysql_query($sql); if (($city = mysql_fetch_assoc($run)) == true) { echo 'Location: ' . $city['cityname']; } and after i use this? <b>City:</b> {$run['$city']}<br /> sorry i dont understand this things x.x Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted April 29, 2013 Share Posted April 29, 2013 and after i use this? <b>City:</b> {$run['$city']}<br /> sorry i dont understand this things x.x No, just place that entire thing where you want the city name to show up and it will Quote Link to comment Share on other sites More sharing options...
badurek Posted April 29, 2013 Author Share Posted April 29, 2013 No, just place that entire thing where you want the city name to show up and it will <b>Name:</b> $gn{$u} $d<br /> $sql = "SELECT `cityname` FROM `cities` WHERE `cityid` = '{$ir['location']}'"; $run = mysql_query($sql); if (($city = mysql_fetch_assoc($run)) == true) { echo 'Location: ' . $city['cityname']; } <b>Level:</b> {$ir['level']}<br /> <b>Crystals:</b> {$ir['crystals']}<br /> this? Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted April 29, 2013 Share Posted April 29, 2013 <b>Name:</b> $gn{$u} $d<br /> $sql = "SELECT `cityname` FROM `cities` WHERE `cityid` = '{$ir['location']}'"; $run = mysql_query($sql); if (($city = mysql_fetch_assoc($run)) == true) { echo 'Location: ' . $city['cityname']; } <b>Level:</b> {$ir['level']}<br /> <b>Crystals:</b> {$ir['crystals']}<br /> this? Ummmm, sure. If thats where you want it. But it looks like to me your going to get errors cause I believe you inserting it inside something thats already printed. You need to end your print before the queries and start it back up after the queries Quote Link to comment Share on other sites More sharing options...
badurek Posted April 29, 2013 Author Share Posted April 29, 2013 worked, with the code in the start of page: $sql = "SELECT `cityname` FROM `cities` WHERE `cityid` = '{$ir['location']}'"; $run = mysql_query($sql); $city = mysql_fetch_assoc($run); and: <b>Local:</b> {$city['cityname']}<br /> thx for the help guys =D Quote Link to comment Share on other sites More sharing options...
crimec Posted April 29, 2013 Share Posted April 29, 2013 {$ir['location']} or {$r['cityname']} Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted April 29, 2013 Share Posted April 29, 2013 {$ir['location']} or {$r['cityname']} I shouldnt even reply to this but if you read previous posts you would see that location prints an int and cityname will most definitely print an undefined var in this case 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.