944,010 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 5046
  • MySQL RSS
Aug 14th, 2007
0

how do i import data from a csv file to my mysql database

Expand Post »
i tried like a million things and im ready to murder someone, can someone walk me through it? thanks.
Similar Threads
Reputation Points: 37
Solved Threads: 1
Posting Whiz in Training
cmills83 is offline Offline
249 posts
since Jun 2004
Aug 15th, 2007
0

Re: how do i import data from a csv file to my mysql database

MySQL commands :

Quote ...
You can then import it into a MySQL table by running:

load data local infile 'file.csv' into table table
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(field1, field2, field3)

The fields here are the actual tblUniq table fields that the data needs to sit in. The enclosed by and lines terminated by are optional and can help if you have columns enclosed with double-quotes such as Excel exports, etc.
http://dev.mysql.com/doc/refman/5.0/en/load-data.html

WIth PHP :

Look in the attached file.


- Mitko Kostov
Attached Files
File Type: zip csv2mysql.zip (2.2 KB, 273 views)
Last edited by MitkOK; Aug 15th, 2007 at 9:21 am.
Reputation Points: 59
Solved Threads: 12
Junior Poster
MitkOK is offline Offline
142 posts
since Jul 2007
Aug 15th, 2007
0

Re: how do i import data from a csv file to my mysql database

Double post, please delete it.
Last edited by MitkOK; Aug 15th, 2007 at 9:20 am.
Reputation Points: 59
Solved Threads: 12
Junior Poster
MitkOK is offline Offline
142 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: Separator help
Next Thread in MySQL Forum Timeline: Passing Variable Values as a parameter Name in MySQL





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC