Jump to content


Tab delimited issue - please help!

  • Please log in to reply
2 replies to this topic

#1 Mr Chris

Mr Chris
  • Members
  • PipPipPip
  • Advanced Member
  • 336 posts

Posted 20 April 2006 - 11:25 AM

Hi Guys,

Trying to load a tab-delimited file to a MySql database, but getting the error message:

INSERT INTO test (first_name, last_name, department, dob) VALUES ('')Column count doesn't match value count at row 1

But I have the same amount of columns in my table as I do in my tab-delimited file being uploaded. I've also echoed out the query, but still don't understand. Can anyone please advise by looking at the code below – especially my INSERT into statement?

Many Thanks


oh and here's the code

(Edit - won't let me post the code for some reason so a link can be found) [a href=\"http://www.thisisslough.com/code.txt\" target=\"_blank\"]HERE[/a]

#2 slashemail

  • Members
  • PipPip
  • Member
  • 15 posts

Posted 20 April 2006 - 11:52 AM

certailny tour query is wrong at this point --> INSERT INTO test (first_name, last_name, department, dob) VALUES ('')

The query should have the values entered or left blank atleast.
The right query would be

INSERT INTO test (first_name, last_name, department, dob) VALUES ('','','','');

Just note that when you explicitly mention the parameters of the insert statement, then you should mention the corresponding values also.

Please refer to th mysql manual & have a look at the insert SYNTAX.

#3 kenrbnsn

  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 20 April 2006 - 11:56 AM

Are you parsing your input records into individual fields? If not, you should be. Take a look at the [a href=\"http://www.php.net/fgetcsv\" target=\"_blank\"]fgetcsv()[/a] function. It may help you.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users