I'm using codeigniter for make a post and comments system. I did all the querys but I don't know how get the comments in the table post\_comment. This is my query for take all the post shared. Thank you for the help.

```
function get_post_profile($user_id,$limit) {
        $this->db->select('post_user.user_id,post_user.id_post_shared,post_shared.post_text,users.name,users.surname,users.id');
        $this->db->join('post_shared', 'post_shared.id_post = post_user.id_post_shared');
        $this->db->join('users','users.id = post_user.user_id');
        $this->db->where('post_user.user_id',$user_id);
        $this->db->order_by('post_user.id_post_shared','DESC');
        $this->db->limit($limit);
        $query = $this->db->get('post_user');

        if ($query->num_rows() > 0) {
            return $query->result();
        } else {
            return false;
        }

    }

```

users\_table

```
id | name | surname |
1    jhon    Smith
2    Sally   Dunk

```

post\_user table

```
id_post_shared | user_id |
      1             1

```

post\_share table

```
id_post | post_text
   1      Hello guys

```

post\_comment table

```
comment_text | id_post | id_user
   Hello!        1          2

```