[eluser]HSKrustofsky[/eluser]
Sorry if I sound stupid, but I tried doing what you posted, and can't seem to get it to work. Just to attempt to make sense of stuff, I have a site with videos on it. The videos(video embed code) is set in a table named videos which has an ID number. The comments are set in a table named comments, where it ID really has no meaning, but I have a row named entry_id which store the 3rd uri segment, which is the ID number of the video, from videos(table).
The first code you helped me on only worked to count the comments within the actual video's page, where the comments are displayed. Now, I have a page that has a list of videos(showing name, description, etc...) linked to the actual video, and I would like display the number of comments on the video list.
Following your code, this is what I did:
Code:
$this->db->select('videos.*, count(comments.entry_id) as num_comments');
$this->db->where('videos.id', $this->uri->segment(3));
$this->db->from('videos');
$this->db->join('comments', 'comments.entry_id = videos.id', 'left');
$this->db->group_by('videos.id');
$this->db->get();
It just comes out blank. Also, do I have to call/do anything special in the controller? Just wondering when to call num_comments, or is num_comments what I call on in the views page? Once again, sorry if I sound, or did anything stupid. Just doing something new in a project, and have little/no idea what to do in this instance...