This is a two-step problem.
First Step:
There is one field(Address) in a table that unfortunately populated with the City, State and ZIP(It's not my fault, but it is my problem). I need to move the data into its own field. There are over 27,000 fields so I am trying to write an application that parses the data which is is one of the two following formats:
SANTA BARBARA CA 93105
or
SANTA BARBARA, CA 93105
I need to break the data up like this:
$city = "SANTA BARBARA"
$state = "CA"
$zip = "93105"
Second Step:
The second step is to incorporate the first step(above) into an application(one page) that basically queries the entire table and fixes the data.
So with the big picture in mind this is what the application will need to:
1. Run the query to get the "Address field" and "ClientID"(PRIMARY KEY) of all records in the Clients table
$query1 = "select Address, ClientID from Clients";
Parse the data(see step one) from the first record in the result and associate it accordingly(city, state and zip)
Then plug parsed data into an Update query and run the query:
$query2 = "Update Clients' set
City = '$city',
State = '$state',
Zip = '$zip'
where ClientID = '$clientid' ";
Loop through the query recordset till all records have been fixed.
Thanks in advance for any time and effort.
Thanks,
Josu