473,396 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Importing with phpMyAdmin

Hello,

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
phpMyAdmin.

I'm using phpMyAdmin 2.9.0.2 and MySQL 4.1.10

Thanks

Feb 9 '07 #1
1 5512
Toine wrote:
Hello,

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
phpMyAdmin.

I'm using phpMyAdmin 2.9.0.2 and MySQL 4.1.10

Thanks
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:

TRUNCATE <table>;
LOAD DATA INFILE <file.csvINTO TABLE <tableFIELDS TERMINATED BY ',';

Replace <tablewith the target table, and <file.csvwith 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
the server.

Options:
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.
Feb 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: SCS | last post by:
Running PHP 4.5.7 PHPMyAdmin 2.5.7-pl1 IIS 6 I am thrying to get phpmyadmin to work, but whenever I click a link or try to browse a database I get a 404 error, because the PmaAbsoluteUri...
1
by: steve | last post by:
Hi, I have a 80 meg dump file created with mysqldump. I need to import it into a mysql db on Windows. On linux, I say "shell>mysql dbname < dumpfilename" But that does not work on Windows. ...
4
by: Nick Kerzman via MySQLMonster.com | last post by:
Any assistance would be greatly appreciated. I'm relatively new to working with MySQL. I exported my DB with phpMyAdmin 2.6.0-pl3 running MySQL 4.1.7 I'm trying to import it with phpMyAdmin...
2
by: Jean Bidule | last post by:
Hi, I installed phpmyadmin to test my site on my homecomputer. The table i want to "upload" in my mysql table is about 5 Mb but in phpMyadmin the maximum size is 2048 kb. Where can I change...
5
by: Marcus | last post by:
Hello, I am having a problem with a query in phpMyAdmin... it works fine on my localhost, but the exact same query produces an error in phpMyAdmin on my server: localhost: PHP 4.3.11, MySQL...
0
by: st.frey | last post by:
I've got a problem with importing chinese characters into a mysql-table and have read several mailings but didn't find a solution. i have a utf-8 text file that contains chinese characters. the...
2
by: Victor | last post by:
Could anybody kindly point me to a clue in the following enigma : I have phpMyAdmin - 2.8.2.4 and MySQL - 4.1.13-nt. In the phpMyAdmin opened in any browser I am able to enter and store Russian...
3
kickingthehabbit
by: kickingthehabbit | last post by:
Hi All new to all of this I just downloaded reactor server. everything works fine except Mysql - SQL import files. I am trying to import file createdb.sql I open DB and try and import with...
2
by: seanh | last post by:
Hi all, I need some advice regarding phpmyadmin, I installed phpmyadmin directory in the htdocs but when I go to my http://mysite.com/phpmyadmin I get a 500 internal error. I checked the files...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.