User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 423,610 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,201 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 2369 | Replies: 2
Reply
Join Date: Jun 2004
Posts: 210
Reputation: cmills83 is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
cmills83 cmills83 is offline Offline
Posting Whiz in Training

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

  #1  
Aug 14th, 2007
i tried like a million things and im ready to murder someone, can someone walk me through it? thanks.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2007
Location: Sofia, Bulgaria
Posts: 138
Reputation: MitkOK is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
MitkOK's Avatar
MitkOK MitkOK is offline Offline
Junior Poster

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

  #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 8:21 am.
Attached Files
File Type: zip csv2mysql.zip (2.2 KB, 37 views)
Reply With Quote  
Join Date: Jul 2007
Location: Sofia, Bulgaria
Posts: 138
Reputation: MitkOK is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
MitkOK's Avatar
MitkOK MitkOK is offline Offline
Junior Poster

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

  #3  
Aug 15th, 2007
Double post, please delete it.
Last edited by MitkOK : Aug 15th, 2007 at 8:20 am.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 8:46 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC