View Full Version : Import .csv into phpMyAdmin Table Column
tomyknoker
04-06-2007, 01:52 PM
Hi all,
I have a table created in phpMyAdmin, and want to import data into one of the columns, I assume I select the table and then click 'Import' > 'CSV'... When I submit this I get the following error...
Invalid field count in CSV input on line 1.
I created the file in Excel and saved it as a .csv I did notcie that the file just has each data on a new line, should it have comma's?
codeexploiter
04-10-2007, 03:58 AM
I think the import operation will succeed only if your tables field count matches with the field count of your CSV file. In your case you want to insert data in a number of fields in your CSV file into a single field of your table.
Instead of using the PHPMyAdmin methods you could've developed a PHP script that does what you are looking for.
archana
08-12-2008, 09:55 AM
Is there any site where i can see how to upload csv file in phpmyadmin?
I am very confused with
Fields terminated by
Fields enclosed by
Fields escaped by
Lines terminated by
Column names
Please help me.
This is my site where i want this.
India travel city (http://indiatravelcity.com)
India's Top Colleges (http://indiastopcolleges.com)
Dear archana:
What codexploiter said is correct, but if you want to use phpMyAdmin, you can probably just leave all the defaults as they are and just add the column name you want the data in. For example:
Fields terminated by ;
Fields enclosed by "
Fields escaped by \
Lines terminated by auto
Column names yourcolname
If the data is all for one field as you stated, then the csv file has the data on separate lines because it is separate records with line feeds. There would be commas between the fields if you had multiple fields per record, but you do not. So just put your column name, leave the rest alone, and give it a try. Don't be afraid to try things. Make a copy of the table if it has data in it already and play around with the copy first. You won't hurt anything. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.