Column count doesn't match value count at row 1

So I read the other posts but this question is unique. So this SQL dump file has this as the last entry.

INSERT INTO `wp_posts` VALUES(2781, 3, '2013-01-04 17:24:19', '2013-01-05 00:24:19'.

I'm trying to insert this value to the table...

INSERT INTO `wp_posts` VALUES(5, 5, '2005-04-11 09:54:35', '2005-04-11 17:54:35'

it gives me the error, "Column count doesn't match value count at row 1." So I'm lost on the concept of how the column and row apply here.

Doesn't 2781,3 mean row 2781 and column 3? And doesn't 5,5 mean row 5 and column 5?

Solutions

  1. you missed the comma between two values or column name
  2. you put extra values or an extra column name

The error means that you are providing not as much data as the table wp_posts does contain columns. And now the DB engine does not know in which columns to put your data.

To overcome this you must provide the names of the columns you want to fill. Example:

insert into wp_posts (column_name1, column_name2)
values (1, 3)

Look up the table definition and see which columns you want to fill.

And insert means you are inserting a new record. You are not modifying an existing one. Use update for that.

You should also look at new triggers.

MySQL doesn't show the table name in the error, so you're really left in a lurch. Here's a working example:

use test;
create table blah (id int primary key AUTO_INCREMENT, data varchar(100));
create table audit_blah (audit_id int primary key AUTO_INCREMENT, action enum('INSERT','UPDATE','DELETE'), id int, data varchar(100) null);
insert into audit_blah(action, id, data) values ('INSERT', 1, 'a');
select * from blah;
select * from audit_blah;
truncate table audit_blah;

delimiter //
/* I've commented out "id" below, so the insert fails with an ambiguous error: */
create trigger ai_blah after insert on blah for each row 
begin 
  insert into audit_blah (action, /*id,*/ data) values ('INSERT', /*NEW.id,*/ NEW.data);
end;//

/* This insert is valid, but you'll get an exception from the trigger: */
insert into blah (data) values ('data1');

Similar questions

SQL - Replace value of column from another column value with condition
Ok to make it very clear, i have table look like this: i want to be like this one : how to change the value post_title of "product_variation" following the value of post_type "product" as the parent. and if i have about 1000 product, how can i change it...?
MySQL query find specific column data but exclude if it contains another specific column data (same column)
I'm trying to change the post_status in a wordpress database based on 2 things. First all posts must have term_taxonomy_id = 2902 and then exclude the posts that also have term_taxonomy_id = 3152 This is the database structure: Table wpsite_posts Table wpsite_term_relationships Column ID and Column Object ID contains the data that match between the...
Select posts that match multiple category names, must match all categories listed
I need to search for posts that belong to multiple categories, but they must match all categories listed, as in if I list category names 'japanese' and 'dessert' the matching posts need to be in both the 'japanese' and 'dessert categories. Is there something like category__and for category names? I am using a wordpress multi instance and my categor...
Regex to match YouTube links, need to omit end of line from match
(Simplified) code from a WordPress project: $content looks something like this: And I want to add $append to the matches and get this: But instead I am getting this: ...because the end-of-line is being included in the match. Any suggestions? Regex or non-regex solutions welcomed.
Match string in REQUEST_URI and redirect to that match
I want to redirect the old URL /bakery/pie?id=55 or /bakery/cake?id=433 to /bakery/pie or /bakery/cake. I tried to redirect on match but I'm error log shows "Request exceeded the limit of 10 internal redirects" This is running on WordPress. What is wrong with the above configuration?
How do I match background color with PHP to match text color?
I am a beginner at using PHP! I know there have been questions like this before, however, they do not work for me the way I want them too. Here's what's going on: I have multiple background images that I implement using css and php. Each of those images, so far, are black, white, and blue. I want to be able to write some php...again I'm a beginner ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.