Countries, States and Cities database of world

This time i am going to give you a very useful database that is countries, states and cities data of world in sql.

Every time when we plan to create a registration form then we stuck on one point that is how can we get list of all Countries, States and Cities of world.
So don’t worry i have solution, I have created mapped database of Countries, States and Cities So now you can easily get mapped .sql file of countries, states and cities from here and can add on your web page as per your requirement.







Copy and paste below script to add city state country list in your website
Note*: Support of below script has been terminated due to heavy load. Please download full source code and configure it on your own server then use it.

<select name="country" class="countries" id="countryId">
<option value="">Select Country</option>
</select>
<select name="state" class="states" id="stateId">
<option value="">Select State</option>
</select>
<select name="city" class="cities" id="cityId">
<option value="">Select City</option>
</select>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://lab.iamrohit.in/js/location.js"></script>

10+ FREE PHP MySql City State Country Dropdown

Following are the list of popular top rated hand picked PHP MySql City State Country Dropdown.

I Hope you liked Hand-picked list of PHP MySql City State Country Dropdown, Don’t forget to Subscribe My Public Notebook for more useful Hand-picked PHP and MySql code examples, tutorials and articles.

If you like this post please don’t forget to subscribe My Public Notebook for more useful stuff.

66 Replies to “Countries, States and Cities database of world”

  1. My family always say that I am wasting my time here at web, but I know
    I am getting know-how daily by reading such fastidious articles or reviews.

  2. Hello, I wish for to subscribe for this webpage to take newest updates, so where
    can i do it please help out.

  3. Greetings from California! I’m bored to death at work so I decided to browse your website on my iphone
    during lunch break. I enjoy the information you provide here and can’t
    wait to take a look when I get home. I’m
    shocked at how fast your blog loaded on my phone
    .. I’m not even using WIFI, just 3G .. Anyways, fantastic site!

  4. Hi,
    Thanks for sharing.. For edit screens how can we bind the coutry/state/city as selected from database to design page can you guide please

  5. Using Jquery you can bind the selected country/state/city, What are you storing in database it’s id or name?
    Best way to download full code from my github repository and configure in your project.

  6. Thanks for the wonderful js. My question is that, are the attributes used countryid, stateid and cityid standard? how can we access these attributes in javascript or php?

  7. Dude you are the best, i have been searching the web for something like this for quite sometime. you just saved me lots of work and headache.

    Keep up the good work

  8. Hi Sunil
    Use below script to fetch states and cities list of india.
    Click Here For Demo

    <select name="state" class="states" id="stateId">
    <option value="">Select State</option>
    </select>
    <select name="city" class="cities" id="cityId">
    <option value="">Select City</option>
    </select>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="http://lab.iamrohit.in/js/location.js"></script>
    <script>
    $(function() {
      var loc = new locationInfo();
          loc.getStates(101);
    });
    </script>
  9. Thanks with this helpful script!

    Let say it detected my IP is in Australia, how could it be selected as Australia initially when page load?

  10. i subscribed bt there is no option for downloading the code. I’m trying to download Country,state and city complete code but i’m not able to download.

  11. After successful subscription, You have to enter your email again and press subscribe/download button to start download. But don’t worry i have sent all download details on your mail id.

  12. Thanks for the Database. But please can you just post that your Demo version for us? Am using the Database with some JQuery script but am finding it difficult to insert the Country, State, and City Name inside the database instead of the ID.
    Am working on Localhost server so I cant use that your markup code.

    Please just integrate the Database in a PHP file like your demo and share it here. thanks bro.

  13. Okay thanks bro, have downloaded it and it’s working, but how can I insert Name of Country, State and City into Database instead of ID? Please bro its urgent.

  14. I would like the name of Country, State and City be inserted inside Database instead of ID. Please bro, help!!

  15. Hi, Thanks for sharing this useful script.
    How can i show the β€œindia” selected when page loads ?

  16. Hi Raghava,

    Use below script to fetch states and cities list of india.
    Click Here For Demo

    <select name="state" class="states" id="stateId">
    <option value="">Select State</option>
    </select>
    <select name="city" class="cities" id="cityId">
    <option value="">Select City</option>
    </select>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="http://lab.iamrohit.in/js/location.js"></script>
    <script>
    $(function() {
      var loc = new locationInfo();
          loc.getStates(101);
    });
    </script>
  17. Thanks a ton Rohit for this wonderful script and data. I was looking for this script for many days. I’ll try it and let u know if i face any issues. Thanks again.

  18. I am getting below alert.

    Error found
    Error Code: 0
    Error Message: Error

    Api is working fine. Please suggest what i’m doing wrong.

  19. When i enter my own database details in dbconfig.php , i start getting this error
    Error found
    Error Code: 200
    Error Message: OK
    ..Please help out

  20. Please check your php version it must be php v5.5+ because here I used exceptional handling with finally keyword which doesn’t support php lower version . if still you are getting same error try to figure your php server side error, you are getting this jquery error because there is some error on your server side code

  21. Thanks. It did save a lot of time but then lot of countries, states and cities do not have matching data. Also few matching results is not proper.

  22. Thanks for a greate article…

    My country “Sweden” have about 25% wrong names of states and cities… So I start wondering if every country, city etc also is messed up? If so the .db is worthless…

    Can we bring the country list from some better source?

  23. Hi Rohitkumar,

    Thank you very much. Using your site save my lots of time.

    You are genius…

  24. When i enter my own database details in dbconfig.php , i start getting this error
    Error found
    Error Code: 200
    Error Message: OK
    ..Please help out

  25. Thanks for the wonderful help. I integrated this in my project. Worked well. I want the options value to be the name of the country/state/city but currently its theirs ids respectively. I tried changing the value from key to value in location.js but that brought problems. How can I achieve that. Thank you.

  26. Hello,
    Nice tutorial..
    But actually i want to connect database also..so that selected country , state and city will insert into database.
    can u provide me solution for that.
    Thanks

  27. Thanks – very helpful!

    A couple of corrections needed:
    United States list incorrect:
    Remove Byram, Cokato, Lowa, Medfield,New Jersy, Ramsey, Sublimity, Trimble
    Also 1 error in SQl State Inserts

    Thanks

  28. Yes,Need to correction.United states List incorrect.Also need for correction UAE STATES List.Otherwise helpful for starting work.
    Thanks

  29. When i enter my own database details in dbconfig.php in codeignitor 3.x , i start getting this error
    Error found
    Error Code: 200
    Error Message: OK
    ..Please help out to confiq your api in codeignitor 3.0

  30. I have an error pop up message:
    Error found
    Error Code: 200
    Error Message: OK

    Please help me.
    Already change db conn using my db.

  31. I just go through the DB of countries, states, and city.and noticed that some impurities in data. I checked states tables and noticed that there is states like ‘natwar’,’kenmore’,’vaishali’,’Narora’,’paschim medinapur’, which is not exists as states in india, they are actually cities or districts, so kindly please update the DB, Thank you.

  32. Hi, Thanks by this awesome DB.

    I would like to help improving the costa rican cities list. Most of them are wrong.

    How can I do it?

  33. Most of the data is wrong. Many cities and countries have spelling mistake. Not good for production. But good for testing.

  34. Hello Rohit, Do you also possess dropdown list for Taluks and villages database for districts of Indian states!! If yes, please do share, it would be really helpful to us.

  35. Pingback: weight Loss tips

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.