country and state codes

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

country and state codes

Post by phpScott »

I have a project that wants to take in peoples country and state/prov names.
A select box is prefered, these will of course be dynamcally created from a db.

The problem is how to get all the state/prov codes easily into a db. Countries are easy as there is a resonable number of these but to do the state names by hand will be a monumental task.

Question is, is there a source out there that has the all the country states out there that can be easily converted to a db or does someone have one that they are willing to share?

Thanks

phpScott
User avatar
Wayne Herbert
Forum Commoner
Posts: 34
Joined: Tue Apr 29, 2003 3:13 pm
Location: Houston, Texas

Post by Wayne Herbert »

The CIA World Fact Book at

http://www.cia.gov/cia/publications/fac ... nt/ar.html

list the provinces/states for each country but not in a format that is readily adaptable for db usage... although you might be able to toss something together to break up a comma delimited list.

The State Department offers a list of countries with FIPS codes at

http://www.state.gov/www/regions/indepe ... tates.html

but there is no subdivision information.

An interesting list of countries and cities with a "dynamic weather server", whatever that is.

http://weather.interceptvector.com/list.php

A list of websites to official country pages

http://www.psr.keele.ac.uk/official.htm

I'd say the CIA pages would be the best bet. I reckon you could grab each page with a script, search for "Administrative Divisions", then grab the comma delimited list. It is still a big project. I'd love a copy of your DB when you get through.
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

I have a text file with countries and another one with USA states. The lines are separated with \n\r, and the fields are separated with \t. As for international provinces, I do not know where to get them.

Send me an email letting me know where to send the files.

To load them into a DB, just use a SQL statement with "LOAD LOCAL INFILE".
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Anyone know of a place that will show each zipcode and it's state (or relative city)?
Image Image
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

list of countries and states

Post by phpScott »

I actually have a link that lists all the countries using iso-3166 standards
http://www.tu-berlin.de/zrz/dienste/net ... -3166.html

and another that lists countries and their states or provinces
http://www.eki.ee/knab/adm2.htm

I am just trying to save some poor drone endless hours of data entry.
That poor drone just might be me.

I was wondirning how places like msn does it when you sign up for a new hotmail account the list of states/provinces. I know how to do the page reload but where the heck do they get that list, or do/did the have some one type that all in.

phpScott
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Post Reply