[eluser]cristian_c[/eluser]
So I have multiple tables that I need to pull the data from. This is how I have been doing it but I not confident that this is the best way to do this. here is some code
Code:
function getBlogs()
{
$query = $this->db->get('blogs');
$result = $query->result_array();
foreach($result as $i => $post){
$result[$i]['blogger'] = $this->getBlogger($post['author_id']);
$result[$i]['categories'] = $this->getCategory($post['cat_id']);
}
return $result;
}
function getBlogger($author_id)
{
$this->db->where('id',$id);
$query = $this->db->get('accounts');
return $query->row_array();
}
function getCategory($cat_id)
{
$this->db->where('post_id',$cat_id);
$query = $this->db->get('posts_categories');
return $query->result_array();
}