Do you have a question? Post it now! No Registration Necessary. Now with pictures!
February 9, 2007, 2:40 am
rate this thread
I want to import a csv file into my table. However, I need to empty
the table before I do this. The problem is, I only see an option to
"replace" the data. Is there a way to empty a table AND simultaneously
import a csv? I know this is possible with the mysqlimport command
(with the --delete argument), but I'm not if it's possible in
I'm using phpMyAdmin 220.127.116.11 and MySQL 4.1.10
Re: Importing with phpMyAdmin
This is more of a PHP question...
PMA's import function is for MySQL formatted data, not CSV.
Not sure about this "replace data" option to which you refer. It does
not exist in the import window.
To import CSV files you'd be using the SQL window, so you'd need two
lines in the query:
LOAD DATA INFILE <file.csv> INTO TABLE <table> FIELDS TERMINATED BY ',';
Replace <table> with the target table, and <file.csv> with the name of
your import file.
Note this may not work if you're on a shared host; you can't just point
PMA to a file on your local system & hope it will magically import up to
Re-format the CSV code into MySQL format, pre-pend a TRUNCATE statement
into the query, and use PMA's Import feature.
Write your own script to do the import, have it check IP to keep
malicious users from accessing it, and just bookmark it in your browser.
- » Two way syncronizing with a website database with a local database
- — Previous thread in » MySQL Database Forum
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum