I am getting this error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error' in ...
..whenever I execute this code with PDO:
//Select data from the topic.
$s = $dbh->prepare("SELECT * FROM forum_topics WHERE forum_id=:forum_cat_id AND topic_id=:topicid");
$s->bindParam(':forum_cat_id', $forum_cat_id);
$s->bindParam(':topicid', $topicid);
$s->execute();
$f = $s->fetch();
$s = $dbh->prepare("UPDATE forum_cats
SET
forum_last_postid = :last_post_id, forum_last_posttime = :time,
forum_last_userid = :userid, forum_last_username = :username,
forum_posts=forum_posts+1
WHERE forum_id = :forum_cat_id");
$s->bindParam(':last_post_id', $last_post_id);
$s->bindParam(':time', $time);
$s->bindParam(':userid', $userid);
$s->bindParam(':username', $userdata['username']);
$s->bindParam(':forum_cat_id', $forum_cat_id);
try {
$s->execute();
}
catch(PDOException $e) {
die($e->getMessage());
}
if (count($s->fetchAll()) == 0) {
return 3;
}
I have no idea why this is happening. I've checked the query, and I simply cant find any errors..