summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2014-06-14 18:33:55 +0200
committerczaks <marcin@6irc.net>2014-06-14 18:33:55 +0200
commitb12612ac576f0bb2c4f82e55d0596d40db77150d (patch)
tree3cb31424008d40680725217ff5ca2f6e5a946942 /inc
parent427a9938a7fbc43fb515379764d2978d0781ee47 (diff)
fix sql error as reported by a Romanian anon
Diffstat (limited to 'inc')
-rw-r--r--inc/functions.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 9d55f2f2..35a3cc2f 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -2047,7 +2047,8 @@ function buildThread50($id, $return = false, $mod = false, $thread = null, $anti
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->execute() or error(db_error($count));