world database of country state and city

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tokcy
    New Member
    • Sep 2008
    • 45

    world database of country state and city

    Hi everyone,

    I need the world database of country state and city. Actually i have three drop down option in my project in 1st drop down country name should come from database and 2nd drop down state name should come from database according to country and in 3rd drop down cities name should come from database according to states.

    I have tried many search engine but i could not get any proper info regarding this i mean some time i get whole country name or some time i gat only cities name that i do not want. and somewhere is paid.

    If you have any info regarding free database then plz tell me the details.
    i will be very grateful to you...

    thanks

    Tokcy
  • Ciary
    Recognized Expert New Member
    • Apr 2009
    • 247

    #2
    do you have three different databases or 3 different tables within one datebase. in the first case its very simple. you simply use a select statement after you post one drop down list.

    Code:
    <?php if(isset($_POST["country"]){
        $query = "SELECT * FROM states WHERE country =".$_POST["country"]
        }if(isset($_POST["state"]){
        $query2 = "SELECT * FROM cities WHERE state=".$_POST["state"]
        }
    after this: execute the queries and use the resulting array to fill the drop down lists

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Originally posted by Ciary
      do you have three different databases or 3 different tables within one datebase. in the first case its very simple. you simply use a select statement after you post one drop down list.

      Code:
      <?php if(isset($_POST["country"]){
          $query = "SELECT * FROM states WHERE country =".$_POST["country"]
          }if(isset($_POST["state"]){
          $query2 = "SELECT * FROM cities WHERE state=".$_POST["state"]
          }
      after this: execute the queries and use the resulting array to fill the drop down lists
      I think it's the database that he's asking for - not how to query it.

      Check out geo world map (bottom right); it may or may not be what you're looking for.

      I'll move this question to misc because it is not specifically about PHP.

      Moderator.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        This looks even more promising.

        - mark.

        Comment

        • tokcy
          New Member
          • Sep 2008
          • 45

          #5
          I am not looking for php code i ma looking for country state and cities database of world...

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            Originally posted by tokcy
            I am not looking for php code i ma looking for country state and cities database of world...
            Posts #3 and #4 should be of interest then.

            Comment

            • tokcy
              New Member
              • Sep 2008
              • 45

              #7
              post #4 is not free, already i have checked and in post #3 there is no such type of link or option to take a any kind of database for world state and city...

              thanks

              Comment

              • Markus
                Recognized Expert Expert
                • Jun 2007
                • 6092

                #8
                Originally posted by tokcy
                post #4 is not free, already i have checked and in post #3 there is no such type of link or option to take a any kind of database for world state and city...

                thanks
                Bottom right. GeoWorldMap.

                It's not in SQL format, you'll have to do some work to convert it.

                Comment

                Working...