gpt4 book ai didi

php - MYsql插入语句错误

转载 作者:太空宇宙 更新时间:2023-11-03 12:08:00 25 4
gpt4 key购买 nike

运行插入语句时出现 mysql 错误。错误是:

#1136 - Column count doesn't match value count at row 1. The insert has 5 values, BUT the comment id is set to AUTO INC

插入语句如下所示:

insert INTO comments (post_id, comment_name, comment_email, comment_text, status) VALUES ('78', 'm man', 'mon@mon.com', 'testh' 'unapprove')

表格是这样的

1) comment_id       int(10)     AUTO_INCREMENT  2) post_id          int(10)                 3) comment_name     varchar(100)4) comment_email    varchar(100)  5) comment_text     (text)  6) status           (text)      

有人可以帮忙吗?非常感谢你的努力

最佳答案

你犯了一个错误。您忘记在所有值之间设置逗号。更改您的查询:

insert INTO comments (post_id, comment_name, comment_email, comment_text, status) VALUES ('78', 'm man', 'mon@mon.com', 'testh' 'unapprove')

insert INTO comments (post_id, comment_name, comment_email, comment_text, status) VALUES ('78', 'm man', 'mon@mon.com', 'testh', 'unapprove')

关于php - MYsql插入语句错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25590800/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com