views:

69

answers:

3

Hi, I would like to show information on my website based on user's geography. In my current design would not want the user to enter their location/zip code. Using IP I can find user's location but how do i leverage this information to show relevant events/information from surrounding cities/town.

Thanks

A: 

Based on IPs, you only have a certain accuracy with showing location. You should have a option that lets them enter their city/state or zip code.

Once you have long/lat, you just need to run a query to find records in your database a specific distance from that long/lat.

http://stackoverflow.com/questions/894713/php-mysql-select-locations-close-to-a-given-location-from-db

gahooa
A: 

http://www.ipinfodb.com/ip%5Flocation%5Fapi.php

this will send you an xml response with the pertinent information

JERiv
A: 

Lets say you can get their City from the IP address. You would need a database of cities with ID's that would pertain to other database entries. Like:

database table cities    database table restaurants
---------------------    --------------------------
ID       City            ID     city_id     name

1        Los Angelos     1      1           Big Al's

Then you could search for restaurants that have the city_id of the city you got from their IP.

There are so many different approaches to relational databases. This is just one small example.

a432511