Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
importing csv file in phpmyadmin
Old 02-20-2010, 06:22 AM importing csv file in phpmyadmin
Ultra Talker

Posts: 254
Trades: 0
i would like to import a csv file into the database so that i do not have to manually make entries when using a cms


initially i selected the database and then the table into which i want to add new data and exported as csv file and then added deleted all the entries in this file and added 1 new entry following the format in the csv file that i exported

when i import this csv file i keep getting the error

Invalid field count in CSV input on line 1.

while importing the csv file i have changed Fields terminated by from ; to ,

what is the correct procedure so that i dont get this error

also when exporting as csv file should i select the Put fields names in the first row option and there are other options as well, how should i go about so that i dont get the error when importing


also if i select the sql option and then delete the entries and make a new entry and if i import this file i get the error
#1062 - Duplicate entry '1' for key 'PRIMARY'

before importing i have selected the database and selected the table into which i want to import the csv or sql file

also before importing the files i suppose i have to make sure that the file i import is the same name as the table whether i import a csv or sql file

please advice how to go about for csv and sql format

also i guess the procedure for csv format can be followed for an
Microsoft Excell 2000 and CSV for MS Excel i guess
sudhakararaog is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-24-2010, 03:41 PM Re: importing csv file in phpmyadmin
Super Spam Talker

Posts: 755
Name: Barry O' Brien
Location: Ireland
Trades: 0
Try this should do the trick mysqldumper.net/ its a great tool
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
audiomad is offline
Reply With Quote
View Public Profile Visit audiomad's homepage!
 
Old 03-03-2010, 07:59 AM Re: importing csv file in phpmyadmin
Super Talker

Posts: 132
Name: Alvin
Trades: 0
Lemme explain to you step by step on how to export the database to CSV.

1. Select the database, then table you wanna export.
2. Click the Export tab.
3. Select CSV for Ms Excel
4. Tick Save As File
5. Go

(Leave all others as default)

Now, when you edit the CSV file with Excel, just edit, but when you save it, Excel will prompt you to save in Excel format. Click No.

Importing CSV file:

1. When you upload the CSV file, it will automatically detect it as CSV.
2. Change the comma seperated to ";"

In the problem that you face, there are some lines in your CSV file that is giving problem, such as spacing issue. Here's what I usually do:

Seperate the file as several CSV files. Then import seperately. You will later find out which row is giving you problem. Then you can fix it.

If you can't fix it, that means the syntax you have may be wrong. Either in this case you have to add it manually, because sometimes phpmyadmin just won't recognize same syntax from Windows (assuming you are hosted in Linux server).

HTH!
__________________
Over 1700 Web Hosts and counting. Reliable Web Host Reviews -
Please login or register to view this content. Registration is FREE
tim84 is offline
Reply With Quote
View Public Profile
 
Old 03-03-2010, 07:56 PM Re: importing csv file in phpmyadmin
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Quote:
Invalid field count in CSV input on line 1
Based on the above it seems the amount of fields in the table in the database is not the same as the amount of fields in your csv file. What it could be is that the table has a field that it uses as the primary id for the table and usually auto increments the value. Because you're importing the .csv you'll need to add those ids. Odds are it will need to be the very first field.

Hope that makes sense.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to importing csv file in phpmyadmin
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23371 seconds with 12 queries