Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    organize mysql data with php script??

    Hi, I have a database of all the US state,city,zip code, area code. I need to program a script where user can look up counties in a state, cities in a state, and zip codes in a city. The results need to selectable. Is php a good choice in this situation?

    Can I write a php script to organize it for me?

    The problem I have is the databse I have is listed by zipcode.

    ex.
    91201 Glendale CA
    91202 Burbank, CA
    91203 Pasaden, CA

    How can I put all the zips and cities to each State.
    Thank You

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    PHP Code:
    $variable0 "91201 Glendale CA";
    $variable1 "91202 Burbank CA";
    $i=0;
    while(
    $i>50){
    $array explode(' '$variable[$i]);
    $i++;
    }
    //search
    if($array3 == 'CA'){
    print
    "$array1, $array2 $array3";

    Something like that. Basicaly, break down each zip code into an array. The Zip, City, and State. Then you can store all those arrays which have the same 3rd array entry into another array. So it wuold break down like this.

    CountryArray
    CAArray
    Glendale
    91201
    91203
    Burbank
    91304
    91307
    ORArray
    Portland
    97080
    97272
    Salem
    97621
    97314

    I know what im trying to say. But having a hard time saying. Maybe this will give someone else ideas to help ya.
    If I'm postin here, I NEED YOUR HELP!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •