Page 1 of 1

Convert vertical list to database?

Posted: Sat Mar 19, 2011 12:53 pm
by GradyLorenzo
Hi all, trying to figure this one out: I have a list that is formatted as follows:

Code: Select all

John Doe
someStreet
someZip
someState

Jane Doe
someStreet
someZip
someState

Jack Doe
someStreet
someZip
someState
How would I convert this into a format that can be imported into PHP MyAdmin? I would type it one at a time, but the 60k+ entries is a bit intimidating for obvious reasons...

Re: Convert vertical list to database?

Posted: Tue Aug 23, 2011 11:10 am
by greip
The easy way to get this large file into a database is to store the file on your web server, then write a small PHP-script which reads the file and inserts the data into the appropriate table.

Re: Convert vertical list to database?

Posted: Fri Sep 16, 2011 1:18 pm
by califdon
Indeed, that's essentially the only way to do it. What you have to be careful of is data format consistency. I would recommend first writing a script that checks the entire file to be sure that each entry is exactly consistent with respect to how many lines of text and empty lines, whether various escape characters are included in the text, etc. If just one entry has more or fewer lines than the rest, for example, all the following data might be misinterpreted. Once you have a consistent source file, the script to read the file and insert rows into the table should be very simple.