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 8 of 8
  1. #1
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts

    Error in column count?

    What does this error mean and what's the most likely thing that is causing it?

    Column count doesn't match value count at row 1

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by masterofollies View Post
    What does this error mean and what's the most likely thing that is causing it?

    Column count doesn't match value count at row 1
    http://htmlfixit.com/cgi-tutes/tutor...alue_Count.php

    http://bugs.mysql.com/bug.php?id=21774

    best regards

  • #3
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    I understand what it means from that top site. But I even uploaded an old copy that has no errors and im still getting it. So it must be in the database.

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by masterofollies View Post
    I understand what it means from that top site. But I even uploaded an old copy that has no errors and im still getting it. So it must be in the database.
    - check mysql version and look to the second link
    - I don't know how upgrade/downgrade could affect the tables and databeses, could be something wrong that can't be revert
    - upgrade to the last installed version and post the query maybe we can fix it

    best regards

  • #5
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    This adds it to the database

    Code:
    $add = doquery("INSERT INTO {{table}} VALUES ('', '$userrow[id]', '$type', '$item', '$_POST[price]', '". time() . "', '$end', '" . addslashes($_POST[comments]) . "')", "market");

    After you get the error and refresh or click back on your browser. The following code happens

    Code:
    if (mysql_num_rows($result) != 1) {
    		$page .= "<table width='100&#37;' border='1'><tr><td class='title'>Market - Buy Error</td></tr></table><br />
    		Sorry, but the item you attempted to purchase is no longer on the market.  Perhaps it has already been sold. <br />
    		<br />
    		You may return to the <a href='index.php?do=market'>market</a>, <a href='index.php'>previous page</a>.";
    
    		display($page, "Buy Error");
    
    		exit;
    	}
    Additional Information:

    MySQL version 5.0.37-standard-log
    PHP version 5.2.5

    Also in the database in the market table. It says LIMIT(0,200)
    the market was at 202 listings.
    Do you think this limit thing is messing it up? It is on phpmyadmin and I even erased all listings and started back from nothing and uploaded an older bug free copy and it continues to have that error.
    Last edited by masterofollies; 12-31-2007 at 06:54 AM. Reason: -

  • #6
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    I finally fixed it. There was a new field in a different table that was blank, and it was connected to this table in the script. So I deleted the field in the other table and everything works again. Thanks for the help

  • #7
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by masterofollies View Post
    This adds it to the database

    Code:
    $add = doquery("INSERT INTO {{table}} VALUES ('', '$userrow[id]', '$type', '$item', '$_POST[price]', '". time() . "', '$end', '" . addslashes($_POST[comments]) . "')", "market");
    Additional Information:

    MySQL version 5.0.37-standard-log
    PHP version 5.2.5

    Also in the database in the market table. It says LIMIT(0,200)
    the market was at 202 listings.
    Do you think this limit thing is messing it up? It is on phpmyadmin and I even erased all listings and started back from nothing and uploaded an older bug free copy and it continues to have that error.
    - you have 9 fields in the table? If the script works before upgrade and if you don't change the table structure, the question is useless and the only explanation is a bug in mysql
    - what's happend if you run this query, with the same value what generate the error, from phpmyadmin or direct into mysql?
    - I don't see any limit in your query, where did it come from, phpmyadmin?
    - I don't use phpmyadmin but I presume that limit(0,200) is a limitation only for manual query. If you increase this limits I suppose that only the manual query would be affected.

    PS: I'm glad you fix it.,

    best regards and happy new year
    Last edited by oesxyl; 12-31-2007 at 07:35 AM.

  • #8
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    I know you solved it, but part of the problem is not listing the fields in the query. MySQL assumes that the values go into the table fields in the order they are in the query.
    So, for example, if your table has 4 fields:
    Code:
    id, name, setting, etc
    And you don't list them in the query:
    [code]INSERT INTO `table` VALUES ('', 'test', '123', '456');[code]
    MySQL will try to insert '' into id(that should be NULL by the way), 'test' into name, '123' into setting, and '456' into etc. But If you change the number of fields, or add a field at the end of the table that doesn't have a default value, it will cause an error. So, you'll want to use a query like this:
    Code:
    INSERT INTO `table` (`id`, `name`, `setting`, `etc`) VALUES(NULL, 'name', '123', '456');
    And you should have fewer problems like this.


  •  

    Posting Permissions

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