php 插入值列表与列列表不匹配:1136 列计数与第 1 行的值计数不匹配
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16960101/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Insert value list does not match column list: 1136 Column count doesn't match value count at row 1
提问by twigg
I see a lot of people having this issue but all the answers always point to the count not matching the value count but they both have 9 items so not sure why its giving me such an error? Guess i've missed the obvious?
我看到很多人有这个问题,但所有的答案总是指向计数与值计数不匹配,但他们都有 9 个项目,所以不知道为什么给我这样的错误?猜猜我错过了明显的?
$sth = "INSERT INTO `docs` (title, ref, rev, content, owner, contract_id, cat_id, created, updated)
VALUES (:title, :ref, :rev, :content, :owner, :contract :cat, NOW(), NOW())";
$q = $conn->prepare($sth);
$q->execute(array(':title'=>$title, ':ref'=>$ref, ':rev'=>$rev, ':content'=>$contnet, ':owner'=>$owner, ':contract'=>$contract, ':cat'=>$cat));
回答by Dale
You're missing a comma here: (in the VALUES())
您在这里缺少一个逗号:(在 VALUES() 中)
:contract :cat
This
这个
$sth = "INSERT INTO `docs` (title, ref, rev, content, owner, contract_id, cat_id, created, updated) VALUES (:title, :ref, :rev, :content, :owner, :contract :cat, NOW(), NOW())";
Should be
应该
$sth = "INSERT INTO `docs` (title, ref, rev, content, owner, contract_id, cat_id, created, updated) VALUES (:title, :ref, :rev, :content, :owner, :contract, :cat, NOW(), NOW())";