简体   繁体   English

插入值列表与列列表不匹配:1136 列计数与第 1 行的值计数不匹配 - 但数字相同

[英]Insert value list does not match column list: 1136 Column count doesn't match value count at row 1 - But the numbers are the same

I've seen similar questions, but I don't seem to be missing a comma or anything, and TEXT is the value that corresponds with the database column.我见过类似的问题,但我似乎没有遗漏逗号或任何东西,而 TEXT 是与数据库列对应的值。

I'm expecting to be able to submit a log consisting of text into my table, but I get the 1136 error instead.我希望能够将包含文本的日志提交到我的表中,但我收到了 1136 错误。 Removing the personal_log and (text) works fine, on submit I get an automated timestamp in the personal_log_date column and a NULL in the log column.删除personal_log 和(文本)工作正常,提交时我在personal_log_date 列中得到一个自动时间戳,在log 列中得到一个NULL。

I'm very new to all of this and have read through some documentation, and it looks like TEXT should be accepted as a value.我对这一切都很陌生,并且已经阅读了一些文档,看起来 TEXT 应该被接受为一个值。

Thanks for any knowledge you can drop on me!感谢您可以向我提供任何知识!

$sql = "INSERT INTO `personal_log`(`personal_log_date`,`personal_log`) 
            VALUES (CURRENT_TIMESTAMP),(TEXT)";

This tries to insert 2 rows with 1 column:这会尝试插入 1 列的 2 行:

VALUES (CURRENT_TIMESTAMP),(TEXT)

But you want to insert 1 row with 2 columns:但是你想插入 1 行 2 列:

VALUES (CURRENT_TIMESTAMP, TEXT)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM