绑定变量的数量与令牌数量不匹配 - PDO

时间:2015-06-25 22:24:52

标签: php mysql pdo

我一直在为我们网站的基础论坛工作。我使用PDO查询时出现了一些问题:

 number of bound variables does not match number of tokens

这是由这个fllowing代码引起的:

$stmt1 = $conn->prepare("UPDATE topics SET replies=:replies, lastposter=:poster, lastpostdate=:date WHERE id = :id"); 
$stmt1->bindParam(':id', $id);
$stmt1->bindParam(':replies', $replies);
$stmt1->bindParam(':poster', $poster);
$stmt1->bindParam(':date', $date);
$stmt1->execute();

$id$replies$date是整数,$poster是一个字符串。我上面有一个类似的查询,工作得很好,如下:

 $stmt1 = $conn->prepare("UPDATE main SET topics = :topics, lastposter = :poster, lastpostdate = :date WHERE id = :id"); 

0 个答案:

没有答案