...

View Full Version : Invalid column count in CSV input



jchrisphonte
01-24-2012, 05:51 PM
Hello

I am getting the above error when trying to upload a newly researched csv file into mysql.

Invalid column count in CSV input on line 41.

I have made the number of characters large enough to fit all the data yet still not sure why the error....

Any help or direction would be greatly appreciated.
Here is the excel info:

(this is row 40 - column headings listed on the left "-" are not in excel just added here to make it easier to read)

id
event -Admin Forum
company -Professional Pensions
topic
description -This event brings together leading experts in the sector to discuss practical ways in-house schemes can refine the admin process and the best ways to communicate with members.
location -Park Plaza Riverbank London
address -18 Albert Embankment
suite/floor
city -London
state/province
zip/postal -SE1 7TJ
country -UK
day -15
month -3
year -2012
endday
endmonth
endyear
time_from
time_until
contactname -Gemma Capewell
email -gemma.capewell@incisivemedia.com
phone -44 (0)20 7968 4626
website -http://events.professionalpensions.com/adminforum
humantest

(this is row 41 below)

id
event -Advanced Topics In Condominium & Cooperative Law
company -New York State Bar Association
topic
description -Doug Heller will speak on a panel about "Sponsor Obligations to Sell Unsold Apartments" at the Committee on Condominiums and Cooperatives Real Property Law Section event.
location -New York State Bar Association
address -1 Elk Street
suite/floor
city -Albany
state/province -NY
zip/postal -12207
country -USA
day -26
month -1
year -2012
endday
endmonth
endyear
time_from
time_until
contactname
email
phone
website
humantest


and here are mysql settings...



# Column Type Collation Attributes Null Default Extra Action
1 id int(4) No None AUTO_INCREMENT Change Drop More
2 event varchar(255) latin1_swedish_ci No None Change Drop More
3 company varchar(200) latin1_swedish_ci No None Change Drop More
4 topic varchar(50) latin1_swedish_ci No None Change Drop More
5 description varchar(8000) latin1_swedish_ci No None Change Drop More
6 location varchar(255) latin1_swedish_ci No None Change Drop More
7 address varchar(100) latin1_swedish_ci No None Change Drop More
8 suite/floor varchar(20) latin1_swedish_ci No None Change Drop More
9 city varchar(40) latin1_swedish_ci No None Change Drop More
10 state/province varchar(40) latin1_swedish_ci No None Change Drop More
11 zip/postal varchar(10) latin1_swedish_ci No None Change Drop More
12 country varchar(40) latin1_swedish_ci No None Change Drop More
13 day tinyint(2) No None Change Drop More
14 month tinyint(2) No None Change Drop More
15 year int(4) No None Change Drop More
16 endday tinyint(2) No None Change Drop More
17 endmonth tinyint(2) No None Change Drop More
18 endyear int(4) No None Change Drop More
19 time_from varchar(10) latin1_swedish_ci No None Change Drop More
20 time_until varchar(10) latin1_swedish_ci No None Change Drop More
21 contactname text latin1_swedish_ci No None Change Drop More
22 email varchar(40) latin1_swedish_ci No None Change Drop More
23 phone varchar(20) latin1_swedish_ci No None Change Drop More
24 website varchar(100) latin1_swedish_ci No None Change Drop More
25 humantest varchar(10) latin1_swedish_ci No None Change Drop More

felgall
01-24-2012, 07:33 PM
How are you doing the insert - using prepare/bind or doing query? If the latter then the problem is that the first " in the content terminates the query if you don't escape them.

jchrisphonte
01-24-2012, 07:41 PM
thank you for this -- I've replace all the " with a space and this works great now!!

felgall
01-24-2012, 09:32 PM
If you wanted to keep the " all you needed to do was escape the string before including it in the SQL query oe change to using prepare/bind for the insert which keeps the data separate from the SQL.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum