PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Nov 19, 2019 4:28 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Mar 19, 2011 12:53 pm 
Offline
Forum Newbie

Joined: Wed Mar 09, 2011 5:40 pm
Posts: 6
Hi all, trying to figure this one out: I have a list that is formatted as follows:

Syntax: [ Download ] [ Hide ]
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...


Top
 Profile  
 
PostPosted: Tue Aug 23, 2011 11:10 am 
Offline
Forum Commoner

Joined: Tue Aug 23, 2011 8:23 am
Posts: 39
Location: Oslo, Norway
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.


Top
 Profile  
 
PostPosted: Fri Sep 16, 2011 1:18 pm 
Offline
Jack of Zircons
User avatar

Joined: Thu Nov 09, 2006 9:30 pm
Posts: 4484
Location: California, USA
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group