Php 绑定变量时出错

Php 绑定变量时出错,php,mysql,prepared-statement,Php,Mysql,Prepared Statement,我在写一份准备好的声明时出错了 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 foru

我在写一份准备好的声明时出错了

 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));
    }
mysqli_stmt::bind_param--mysqli_stmt_bind_param-将变量作为参数绑定到准备好的语句

因此,在bind_参数中,需要插入5个参数

mysqli_stmt::bind_param--mysqli_stmt_bind_param-将变量作为参数绑定到准备好的语句


因此,在绑定参数中,需要插入5个参数。

我解决了这个问题。我正在尝试绑定
NOW()
字段。我将代码行更改为

  if(!$stmt->bind_param('sssii', $cid, $title, $creator)) {

现在它工作得很好。

我解决了这个问题。我正在尝试绑定
NOW()
字段。我将代码行更改为

  if(!$stmt->bind_param('sssii', $cid, $title, $creator)) {

现在它工作得很好。

U正在绑定3。。。sssU正在绑定3。。。sss