Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8835131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:11:23+00:00 2026-06-14T09:11:23+00:00

I need someone to help me with this problem. My head doesn’t want to

  • 0

I need someone to help me with this problem. My head doesn’t want to think straight today.

So, i have a table named “recensions”, and another named “comments”. In each table, i have a column named “amne_id”. This would make so i could connect the comments to the correct recension.

Now, on my first page, i simply get all the recensions with the code:

$rec = $this->db->get('recensions');

What i want is to count how many comments each recension has. But i have no idea how. I guess i maybe should use JOIN and num_rows()?

Please ask if you dont understand, so i can explain better.

Have a nice day!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:11:24+00:00Added an answer on June 14, 2026 at 9:11 am
    $this->db->select('COUNT(*) as count, recensions.anme_id as recension_id')
    ->from('recensions')
    ->join('comments','recensions.anme_id = comments.anme_id','left')
    ->group_by('anme_id');
    $result = $this->db->get();
    

    Should give you the recensions id and the comment count for that id.

    then loop:

    foreach($result->result() as $row){
        echo "Recension id $row->recension_id has $row->count comments<br />";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help with this problem. I need someone to explain to me why
please someone help out from this headaround problem of me; I have dynamically created
I really hope someone can help with this problem. I have an ajax pagination
Hi All Can someone help me with this problem I have encountered Can I
Please i need someone to help convert this query entity(c#) form. select * from
can someone help with this? I need the following function to do this... $x
I was hoping someone could help me out with this stupid problem I'm having
I had someone from this site help me out with a slider problem I
I have written this small script. Can someone help me fix this I have
Could someone help me on this, i have created simple webservices and it has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.