Why am I getting error #1136 - Column count doesn't match value count at row 1?

后端 未结 3 1402
梦毁少年i
梦毁少年i 2020-12-21 04:27

I get this error:

#1136 - Column count doesn\'t match value count at row 1?

When I try to do this:

INSERT INTO folding_cart         


        
相关标签:
3条回答
  • 2020-12-21 04:56

    I pasted your query into a test environment and I saw this:

    INSERT INTO folding_cartons (part_no, description, count, size, pdf_link, min, max, current) VALUES ('240-63100-00?^?^?,?^?^?YB MV Cherry?^?^?, ?^?^?90?^?^?,?^?^?3 x 2-11/16 x 5-5/64?^?^?, ?^?^?http://www.logicpkg.com/data/hero/copies/240-63100-00.pdf','0','0','0')

    I would guess you have some smart-quote symbols or international characters that look like quotes.

    Just use plain single-quotes to delimit strings.

    0 讨论(0)
  • 2020-12-21 05:02

    Here's what I suggest. I use the SET to insert instead of the common way to naming columns and them values. It is very simple to understand and you know which column has what. Also, to change this into an UPDATE is very simple since it's the same structure (just change the INSERT INTO to UPDATE and add a WHERE clause).

    INSERT INTO `folding_cartons` SET 
     `part_no` = '240-63100-00', 
     `description` = 'YB MV Cherry', 
     `count` = 90,
     `size` = '3 x 2-11/16 x 5-5/64', 
     `pdf_link` = 'http://www.logicpkg.com/data/hero/copies/240-63100-00.pdf', 
     `min` = 0, 
     `max` = 0, 
     `current` = 0;
    
    0 讨论(0)
  • 2020-12-21 05:11

    The single quotes around your strings are different, though I have no idea why. I pasted your query into gedit and used the normal single quote (ascii 39), and I was able to insert successfully.

    INSERT INTO folding_cartons (part_no, description, count, size, pdf_link, min, max, current) VALUES ('240-63100-00','YB MV Cherry', '90','3 x 2-11/16 x 5-5/64', 'http://www.logicpkg.com/data/hero/copies/240-63100-00.pdf','0','0','0');
    

    Again, no clue where the Was this query code-generated or did you paste it into some editor?

    0 讨论(0)
提交回复
热议问题