Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    84
    Thanks
    49
    Thanked 0 Times in 0 Posts

    Invalid column count in CSV input

    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...

    Code:
    	#	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
    Last edited by jchrisphonte; 01-24-2012 at 05:14 PM.

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,608
    Thanks
    0
    Thanked 645 Times in 635 Posts
    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.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    jchrisphonte (01-24-2012)

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    84
    Thanks
    49
    Thanked 0 Times in 0 Posts
    thank you for this -- I've replace all the " with a space and this works great now!!

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,608
    Thanks
    0
    Thanked 645 Times in 635 Posts
    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.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •