View Full Version : Zip code

12-04-2008, 04:56 PM
I am building multiple web pages for my boss, each specific to a certain county. My boss would like the web pages to have a field where I can type in a zip code and have it then connect to the nearest county web page closest to that zip code. I know I can make a drop down list but soon the numbers of zip codes required will be so large scrolling through them will be unreasonable. I have on another server access to a MySQL database and can create a list there but uncertain how to do that. Has anyone done this before, created a mysql database of zipcodes or web pages and then having the two connect?

12-04-2008, 06:08 PM
just put in a search field and search the zip table.
Then a lat long database to figure out which county is closest tot he zip code.

12-04-2008, 06:31 PM
I am looking at how to do that now. I understand that I can build a Mysql database table with zip codes in them. Do I make another with the lat long in them or is that part of the table for zip codes? Perhaps I need more mysql understanding. I have been able to make a recordset for registration on the web page so that was easy enough, but am not certain how the zip code database table will return a web page from the zip code inputted.

12-05-2008, 01:13 PM
Do I make another with the lat long in them or is that part of the table for zip codes?
I don't do the manual part of this myself, but I would guess you need a lat long value for each zip code. This really is a PHP/MySQL question, not a DW one.


12-07-2008, 07:47 PM
Essentially you are trying to calculate the distance between 2 points on the earth. A brief math explaination can be found here


So you need lat/long data of both points in your database. You can find a free one here


Once you have this data in your database you can use SQL query to find locations closest to an input zip code