This query show me with this active record
Posted
by
New Kid
on Stack Overflow
See other posts from Stack Overflow
or by New Kid
Published on 2012-09-04T09:35:15Z
Indexed on
2012/09/04
9:38 UTC
Read the original article
Hit count: 138
php
|codeigniter
I am having trouble getting two tables and passing them to controller:
IN A MODEL:
function get_all_entries() {
$query = $this->db->get('entry');
return $query->result();
$this->db->select('entry_id , count(comment_id) as total_comment');
$this->db->group_by('entry_id');
$comment = $this->db->get('comment');
return $comment->result();
}
IN A CONTROLLER:
$data['query'] = $this->blog_model->get_all_entries();
$this->load->view('blog/index',$data);
How do I return $query
and $comment
variables to controller? I think I am doing it wrong.
© Stack Overflow or respective owner