...

View Full Version : organize mysql data with php script??



MikeSMS
10-11-2004, 11:56 PM
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

Ultragames
10-12-2004, 03:49 AM
$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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum