summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module12
1 files changed, 5 insertions, 7 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 1f048fc40..e038285e2 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1502,21 +1502,19 @@ function comment_num_all($nid) {
static $cache;
if (!isset($cache[$nid])) {
- $comment = db_fetch_object(db_query("SELECT COUNT(nid) AS number FROM {comments} WHERE nid = %d AND status = 0 GROUP BY nid", $nid));
- $cache[$nid] = $comment->number ? $comment->number : 0;
+ $cache[$nid] = db_result(db_query("SELECT COUNT(cid) FROM {comments} WHERE nid = %d AND status = 0", $nid));
}
return $cache[$nid];
}
-function comment_num_replies($id) {
+function comment_num_replies($pid) {
static $cache;
- if (!isset($cache[$id])) {
- $result = db_query("SELECT COUNT(cid) FROM {comments} WHERE pid = %d AND status = 0", $id);
- $cache[$id] = $result ? db_result($result, 0) : 0;
+ if (!isset($cache[$pid])) {
+ $cache[$pid] = db_result(db_query("SELECT COUNT(cid) FROM {comments} WHERE pid = %d AND status = 0", $pid));
}
- return $cache[$id];
+ return $cache[$pid];
}
/**