Reputation: 5791
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?
Upvotes: 4
Views: 8704
Reputation: 562931
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.
Upvotes: 2
Reputation: 1458
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?
Upvotes: 3
Reputation: 49895
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;
Upvotes: 7