fix sql error as reported by a Romanian anon

This commit is contained in:
czaks 2014-06-14 18:33:55 +02:00
parent 427a9938a7
commit b12612ac57

View File

@ -2047,7 +2047,8 @@ function buildThread50($id, $return = false, $mod = false, $thread = null, $anti
if ($query->rowCount() == $config['noko50_count']+1) { if ($query->rowCount() == $config['noko50_count']+1) {
$count = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM ``posts_%s`` WHERE `thread` = :thread UNION ALL SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `file` IS NOT NULL AND `thread` = :thread", $board['uri'], $board['uri'])); $count = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM ``posts_%s`` WHERE `thread` = :thread UNION ALL
SELECT SUM(`num_files`) FROM ``posts_%s`` WHERE `files` IS NOT NULL AND `thread` = :thread", $board['uri'], $board['uri']));
$count->bindValue(':thread', $id, PDO::PARAM_INT); $count->bindValue(':thread', $id, PDO::PARAM_INT);
$count->execute() or error(db_error($count)); $count->execute() or error(db_error($count));