Drew
Drew

Reputation: 3234

Problems importing a CSV file

When i try to import a CSV file into my mysql database I get this error "Invalid field count in CSV input on line 1". But i am sure that my csv file is fine. Below is the first line of the csv file and the structure of the databse:

"","[email protected]","Licia Dallolio","390","37","","",

CREATE TABLE `other_table` (
  `id` int(11) NOT NULL auto_increment,
  `email` varchar(256) default NULL,
  `name` varchar(256) default NULL,
  `opened` int(11) default NULL,
  `checked` int(11) default NULL,
  `category` varchar(256) default NULL,
  `company` varchar(256) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

If anyone can help me out with this I would be very grateful. Thanks

Upvotes: 1

Views: 1393

Answers (2)

too much php
too much php

Reputation: 90978

The trailing comma on the end of the csv line means there are actually 8 fields you are trying to import.

Upvotes: 1

John Boker
John Boker

Reputation: 83699

try leaving out the first column, making it only 6 columns in your csv.

also, take the trailing comma off the end of the line

Upvotes: 2

Related Questions