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

Reply

Join Date: Jun 2004
Posts: 247
Reputation: cmills83 is an unknown quantity at this point 
Solved Threads: 1
cmills83 cmills83 is offline Offline
Posting Whiz in Training

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

 
0
  #1
Aug 14th, 2007
i tried like a million things and im ready to murder someone, can someone walk me through it? thanks.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 142
Reputation: MitkOK is an unknown quantity at this point 
Solved Threads: 12
MitkOK's Avatar
MitkOK MitkOK is offline Offline
Junior Poster

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

 
0
  #2
Aug 15th, 2007
MySQL commands :

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
Last edited by MitkOK; Aug 15th, 2007 at 9:21 am.
Attached Files
File Type: zip csv2mysql.zip (2.2 KB, 58 views)
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 142
Reputation: MitkOK is an unknown quantity at this point 
Solved Threads: 12
MitkOK's Avatar
MitkOK MitkOK is offline Offline
Junior Poster

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

 
0
  #3
Aug 15th, 2007
Double post, please delete it.
Last edited by MitkOK; Aug 15th, 2007 at 9:20 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 3672 | Replies: 2
Thread Tools Search this Thread



Tag cloud for MySQL
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC