0
我有被执行每次有人帖子在我的论坛的答复PDO查询一个问题:PHP - PDO不更新时间()
$time= time();
$s = $dbh->prepare("UPDATE forum_topics SET last_post_user=:user, last_post_userid=:userid, last_post_time=:time, posts=posts+1 WHERE topic_id=:topicid");
$s->bindParam(':user', $userdata['username']);
$s->bindParam(':userid', $userid);
$s->bindParam(':time', $time);
$s->bindParam(':userid', $userid);
$s->bindParam(':topicid', $topicid);
try {
$s->execute();
}
catch(PDOException $e) {
die($e->getMessage());
}
上面的查询不实际更新我的数据库..所有字段,预计:time
正在更新。
在数据库中的结构,last_post_time
是int(20)
我不知道为什么它没有被更新 - 有人可以看到任何问题?我没有收到任何错误或任何错误..
为什么你的列类型是'int'来节省时间? – Rikesh
尝试向你的'bindValue'添加一个类型转换参数,例如:PDO :: PARAM_INT –
@VitKos为了什么? –