473,779 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5539
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
6454
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 auto-detection is nor working properly. Im pretty sure it is a problem with my php.ini file, but Im not sure where to look... can someone please help
1
3072
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. Importing via phpmyadmin is not possible either since we are limited to 2 Meg file size. Any ideas? Please help.
4
2228
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.5.7-pl1 running MySQL 4.0.20 Is this possible? I seem to be getting this error: MySQL said:
2
2300
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 the maximum size of text files in PhpMyAdmin ? Somewhere in "config.inc.php" ? Thank you very much
5
3048
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 4.1.12, phpMyAdmin 2.8.1 server: PHP 4.3.11, MySQL 4.1.12, phpMyAdmin 2.6.3-pl1 SELECT AES_DECRYPT(pass, 'asdf') FROM `test`
0
3714
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 table where i want to import the data using "load data local infile" has collation utf8_unicode_ci. but after the import is done, the chinese characters are converted into so strange characters. to show the chinese symbols in a php-script i use...
2
6808
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 characters in the DB; I cal also call the data back to display them in the phpMyAdmin. When I try to do the same from my own page, only some garbage with double as many characters as an original word gets stored in the DB (at least I see it...
3
4340
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 SQL when I try and import it comes back with
2
1921
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 from phpMyAdmin-3.1.3.2-english that I unziped on my desktop and compared each one to the ftp phpmyadmin directory files on the server so all files are all there. I also added config.inc.php file and put it inside phpmyadmin directory. I was wondering...
0
10302
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10136
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8958
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.