【发布时间】:2015-07-20 03:19:22
【问题描述】:
我正在编写的准备好的语句中出现错误...
Number of elements in type definition string doesn't match number of bind variables on line 33. Create Topic Insert bind_param() failed:
我唯一能想到的是因为NOW() 字段,但我认为不需要为此设置变量?
我是否明显遗漏了什么或可能导致此错误的原因?
//Prepared INSERT stmt for the forum topic
$stmt = $con->prepare("INSERT INTO forum_topics (`category_id`, `topic_title`, `topic_creator`, `topic_date`, `topic_reply_date`)
VALUES(?, ?, ?, NOW(), NOW())");
if ( !$stmt || $con->error ) {
die('Create Topic Insert prepare() failed: ' . htmlspecialchars($con->error));
}
if(!$stmt->bind_param('sssii', $cid, $title, $creator)) {
die('Create Topic Insert bind_param() failed: ' . htmlspecialchars($stmt->error));
}
if(!$stmt->execute()) {
die('Create Topic Insert execute() failed: ' . htmlspecialchars($stmt->error));
}
【问题讨论】:
-
U 正在绑定 3 ... sss
标签: php mysql prepared-statement