我对mysql_affected_rows()
PHP 中的函数有疑问。我使用 MySQL 更新,在 phpMyAdmin 中我可以看到,“已确认”从 0 变为 1,但mysql_affected_rows
仍返回 0!我找不到解决方案。我的代码是:
$query = "UPDATE visits
SET confirmed = 1
WHERE id = ? AND confirmed = 0 AND expire > now() - INTERVAL 10 MINUTE;";
$stmt = $this->conn->stmt_init();
if($stmt->prepare($query)) {
$stmt->bind_param('i',$id); //$id is a function parameter
$res = $stmt->execute();
$stmt->close();
echo mysql_affected_rows();
}