I've been working on a basic forum for our site. I've ran into some trouble with a query using PDO with the error:
number of bound variables does not match number of tokens
This is caused by this fllowing code:
$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
and $date
are integers, $poster
is a string. I have a similar query above that works just fine which is as follows:
$stmt1 = $conn->prepare("UPDATE main SET topics = :topics, lastposter = :poster, lastpostdate = :date WHERE id = :id");