Jump to content

Problem importing CSV into table


ianhman

Recommended Posts

Hi,

I am a complete newbie to MySQL!

I am trying to import a CSV file using phpMyAdmin.

I have uploaded the CSV file via FTP to the root directory on my external server (GoDaddy). According to GoDaddy they allow importing of files into MySQL so there must be something wrong with my query.

In phpMyAdmin I ran the following query:
[code]
load data local infile 'resdatatest2.csv' into table tblNewsletterSubs
fields terminated by ','
lines terminated by '\n'
(ID, EcastID, Email)
[/code]

One the query has run phpMyAdmin then says the file has imported but with "Inserted rows: -1"
so no actual data is being imported. It should have imported 284 rows, not -1 !

The tblNewsletterSubs table structure is as follows:

ID - int(7)
EcastID - int(3)
Email - varchar(75)


I have attached a file sample of the CSV file I am using, I have stripped it down to 3 rows for test reasons. I can't see what is going wrong?

Please help  ???

[attachment deleted by admin]
Link to comment
https://forums.phpfreaks.com/topic/33324-problem-importing-csv-into-table/
Share on other sites

I ended up having to convert the CSV file to an SQL file and insert the data that way by via the Import option on phpMyAdmin. Not ideal as this option only handles file up to 2MB in filesize on the host (GoDaddy) server.

Earlier I mentioned to my host (GoDaddy) that I was trying to import a CSV file and showed them the query I was using. GoDaddy said they do support CSV import and that there was something wrong with my query??

If anyone can provide further help it would be much appericated.
  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.