I have a section in my site where I do need to count the number of comments for a specific post.I actually already built a function for retrieving all the data in the comments DB table (function getComments).
the comments DB table structure is : id(PK) | authorId | datetime | postId | text
Now, since I just need to count them (the comments),I was wondering if,in term of server resources/redundancy is better to use :
$comments=new Comment();
$comments->getComments();
echo count($comments);
Or I'm better build another function (apart from 'getComments')like :
function countComments($postid)
{
//count comments per post
}
thanks
Luca