parse return string into table, separate records

G

Gary Dolliver

Hi all,
I am attempting to receive information from a MySQL DB, which I send up a
zip code (PHP get) and then receive back a string of all records that match.
The problem is I need to separate them into records to be inserted into an
address table.

An example of the return string would be:
&school_name1=EAST ELEM SCHOOL&address1=1234 EAST
AVE&city1=AURORA&school_name2=SOUTH ELEMENTARY SCHOOL&address2=5 SOUTH
ST&city2=AURORA&school_name3=WEST ELEMENTARY SCHOOL&address3=2 WEST
WAY&city3=AURORA&school_name4=NORTH SCHOOL&address4=15 NORTH
AVE&city4=AUROR&n=4&errorcode=0&

I would like this to be inserted into a table that would then have 4 (or
however many records come back) records, with the name, address, and city as
columns. I can parse the string to get this information out, but how would I
make a separate record for each school?
I figure it would be a loop of sorts, but am unsure where to begin (what
would I use to trigger to go to the next record?), any code or guidance that
can be provided would be very helpful, thanks
-gary
 
K

KARL DEWEY

I would bring the data into a Word document and perform the following
Replace_All actions --
^p Space
&school_name ^p
= ^t
& ^t

The data will look like this --
1 EAST ELEM SCHOOL address1 1234 EAST AVE city1 AURORA
2 SOUTH ELEMENTARY SCHOOL address2 5 SOUTH ST city2 AURORA
3 WEST ELEMENTARY SCHOOL address3 2 WEST WAY city3 AURORA
4 NORTH SCHOOL address4 15 NORTH AVE city4 AUROR n 4 errorcode 0

Your data will be separated by tabs.
Save as a .txt file.

Then you can bring into Access. Append the correct field to your table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top