Jump to content
MakeWebGames

Adding user city/location to index.php


SpyderMonkey

Recommended Posts

I am trying to add the user's own location/cityname to index.php and have gotten real close to making it work, but it seems I am missing some small bit. I can get "Location:" to appear, but the cityname never shows up. I know there is just a small thing I am missing but can't identify exactly what is missing.

The line is written:

print "Location: {$ir['cityname']}";

 

I know the missing part is the call to cityname. Any help is greatly appreciated.

Link to comment
Share on other sites

Re: Adding user city/location to index.php

ok just done this simple for you :

 

$query = mysql_query("SELECT * FROM `cities` WHERE `cityid` = '".$ir["location"]."'");
$result = mysql_fetch_array($query);
$location = $result["cityname"];

 

And then were you want it printed in index/ header

Location: $location

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...