:cat_id 的值为 9 并且 :tlk_id 的值为 3 如果我手动输入它们,它将以所需的结果运行,但在绑定它们后它给我的行数为零
<?
$sql = ("
SELECT
p.post_id as sn,
p.subject,
p.username,
COUNT(thread_id)-1 AS responses,
MAX(DATE_FORMAT(p.date_posted,'%e-%b-%y %l: %i %p')) AS first,
MAX(DATE_FORMAT(t.date_posted,'%e-%b-%y %l:%i %p')) AS last
FROM
posts AS p
INNER JOIN
threads AS t
USING
(post_id)
INNER JOIN
register AS u
ON
p.username = u.username
WHERE
t.category_id =:cat_id
AND
p.category_id =:cat_id
AND
t.forum_id = :tlk_id
AND
p.forum_id = :tlk_id
GROUP BY
(t.post_id)
ORDER BY
last DESC
LIMIT $start,$display
");
$sth = $dbh->prepare($sql);
$sth->bindParam(':tlk_id',$tlk_id);
$sth->bindParam(':cat_id',$cat_id);
$r = $sth->execute();
$count = $sth->rowCount();
echo $count;
?>