Providing users a list of country and/or territory names and codes is a common task in developing any web application. This example provides a demonstration of MySQL database structure and PHP code you may download for your own application development use.

A Note About the Data

Note that the data used herein is a snapshot that will not be maintained and is therefore not to be considered accurate or up-to-date. For a more accurate and up-to-date listings of Country and Territory codes you may refer to the International Organization for Standardization (http://www.iso.org), which maintains the ISO-3166 standards for country and territorial codes. Learn more about the ISO-3166 standards at:

View Country/Territory Demos

Click the links below to see demonstrations of Country/Territory listings using PHP interacting with a MySQL database.

Download PHP and MySQL Snippets

The following code and database dumps are shared under the Creative Commons Share-Alike License. For more details, click here.:

  • MySQL Country and Territory Data Dump (UTF-8)
  • PHP Country and Territory Lists Code