SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: Comma-separated files to MySQL
-
May 9, 2003, 08:39 #1
- Join Date
- Apr 2003
- Location
- Denmark
- Posts
- 14
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Comma-separated files to MySQL
Hi
Does anybody know how to tranfer data from a comma-separated file to a MySQL database table.
Lars, DK
-
May 9, 2003, 09:33 #2
Ach. The MySQL I use has a phpAdmin portal.... I'll have a look at the syntax for you.
GDrupal Development -- Hire me!
Drupal Training | Darwin Awards Moderator | Classic Cars
SitePoint | Blog | Rent Games Online | Car | Talent
-
May 9, 2003, 09:39 #3
Ok. phpAdmin spat out the following SQL when I tested it quickly:
Code:LOAD DATA LOCAL INFILE '/home/tmp/phpbLAmAj' INTO TABLE test FIELDS TERMINATED BY ', ' ESCAPED BY '\\' LINES TERMINATED BY '\n'
Drupal Development -- Hire me!
Drupal Training | Darwin Awards Moderator | Classic Cars
SitePoint | Blog | Rent Games Online | Car | Talent
-
May 9, 2003, 09:42 #4
Then again, looking at the options, you'd have to change the LOCAL to something I imagine. Still, now you know the basic command you're after you can check the MySQL documentation.
Drupal Development -- Hire me!
Drupal Training | Darwin Awards Moderator | Classic Cars
SitePoint | Blog | Rent Games Online | Car | Talent
-
May 9, 2003, 15:37 #5
- Join Date
- Apr 2003
- Location
- Denmark
- Posts
- 14
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks Greg! It works fine.
Lars, DK
-
May 17, 2003, 12:04 #6
- Join Date
- Jul 2002
- Location
- USA
- Posts
- 132
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
http://www.mysql.com/doc/en/LOAD_DATA.html
How do I pass the file from say a form file field to the SQL statement so I can create a page to upload a file from the desktop and insert into MySQL table?
Bookmarks