Jump to content
MakeWebGames

Show the name of the city in side panel


badurek

Recommended Posts

<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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

<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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...