我在mysql DB中收到错误,说“#1136列数与第1行的值计数不匹配”

时间:2023-02-05 20:08:33

I'm currently trying to enter values inside my table "user" via phpmyadmin and that's when I receive an error "#1136 column count doesn't match value count at row 1"

我正在尝试通过phpmyadmin在我的表“user”中输入值,当我收到错误“#1136列数与第1行的值计数不匹配”时

我在mysql DB中收到错误,说“#1136列数与第1行的值计数不匹配”

but this error only seems to occur when I have the following trigger entered in my DB, without it the insert works everytime:

但是,当我在我的数据库中输入以下触发器时,似乎只发生此错误,而不是每次插入都有效:

我在mysql DB中收到错误,说“#1136列数与第1行的值计数不匹配”

and this is the table I want to actually "influence" via the trigger above:

这是我想通过上面的触发器实际“影响”的表格:

我在mysql DB中收到错误,说“#1136列数与第1行的值计数不匹配”

what i want to do is take the "username" from the table "user" , and the "points" also from "user" table and insert the same values inside the table ranking after every insert into the "user" table

我想要做的是从表“user”中获取“用户名”,并从“user”表中获取“points”,并在每次插入“user”表后在表排名中插入相同的值

1 个解决方案

#1


3  

When you use INSERT, always include the column names:

使用INSERT时,请始终包含列名:

INSERT INTO ranking (col1, col2)  -- whatever the columns are
    VALUES (new.points, new.username);

I am not sure what user.points and user.username are supposed to be. I imagine you want to include the new values in the ranking table.

我不确定user.points和user.username应该是什么。我想你想在排名表中包含新值。

#1


3  

When you use INSERT, always include the column names:

使用INSERT时,请始终包含列名:

INSERT INTO ranking (col1, col2)  -- whatever the columns are
    VALUES (new.points, new.username);

I am not sure what user.points and user.username are supposed to be. I imagine you want to include the new values in the ranking table.

我不确定user.points和user.username应该是什么。我想你想在排名表中包含新值。