Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
parsing a .txt file to MySQL
Old 06-08-2005, 06:07 AM parsing a .txt file to MySQL
bez
bez's Avatar
Skilled Talker

Posts: 53
Trades: 0
Im about to start writing a method that willl take a text file of:

value1, value2, value3
value1, value2, value3
value1, value2, value3

And copy those values to a MySQL DB (so in this case, 3 entries with 3 fields). I also need to convert the MySQL back into text files. The number of values is variable, as is the name of the MySQL table they will be written to.

Before I dive in and write the thing, it occured to me that this is something that must have been done many times before, probably by more competent coders than me. Ive had a search round the manual and the net but cant find anything, anybody know where i could look?

Thanks for any feedback.

Last edited by bez; 06-08-2005 at 08:13 AM..
bez is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-08-2005, 07:26 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
phpMyadmin has facilities to import CSV (comma separated value) files directly into mysql.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 06-08-2005, 08:10 AM
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Quote:
Originally Posted by 0beron
phpMyadmin has facilities to import CSV (comma separated value) files directly into mysql.
...along with ability to dump the data back into CSV

In fact it is mysql feature, not phpMyAdmin. If you can call mysql command from your script then it is not a problem to even upload the file and merge it by script instead of starting PMA.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 06-09-2005, 05:55 AM
bez
bez's Avatar
Skilled Talker

Posts: 53
Trades: 0
hmmm... are you guys talking about the 'LOAD DATA INFILE' MySQL syntax? thats what im looking into at the moment, it seems to do everything i need.
bez is offline
Reply With Quote
View Public Profile
 
Old 06-09-2005, 08:20 AM
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
In fact I was talking about "mysqldump" and "mysql -p mybase < data.csv"
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to parsing a .txt file to MySQL
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14605 seconds with 12 queries