• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with counting articles on comments and categories on homepage

#4
[eluser]Maglok[/eluser]
Well going from your getComments you know the $postid. So make a new function in the model like about so:

Code:
function countComments($postid) {
    $this->db->from('comments');
    $this->db->where('post_id', $postid);

    return $this->db->count_all_results();
}

You effectively query the comments from a post and count them. Count is also a rather 'cheap' SQL function.


Messages In This Thread
Need help with counting articles on comments and categories on homepage - by El Forum - 02-16-2010, 04:26 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.