Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mysql

I get this error:

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

When I try to do 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')

What does the error mean?

like image 996
Erik Avatar asked Dec 16 '22 09:12

Erik


2 Answers

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;
like image 120
Book Of Zeus Avatar answered Dec 18 '22 23:12

Book Of Zeus


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?

like image 36
Oceanic Avatar answered Dec 19 '22 00:12

Oceanic