[eluser]Chris Williams[/eluser]
My views will load when they can pull records, but only one will load when the query finds zero records.
My Control:
Code:
function index()
{
$data['check'] = $this->db_session->userdata('id');
$data['my_id'] = $this->db_session->userdata('id');
$data['logged_in'] = $this->freakauth_light->isValidUser();
// get this user's recent posts
$data['query'] = $this->Blog_model->getRecentPosts($this->db_session->userdata('id'));
$data['script'] = TRUE;
$this->load->view('include/header_view', $data);
$this->load->view('home_view', $data);
$this->load->view('include/footer_view');
}
My Model:
Code:
function getRecentPosts($user_name)
{
// get this user's posts
$this->db->select('*');
$this->db->from('posts');
$this->db->join('user', 'user.id = posts.user_id', 'left');
$this->db->where('user.user_name', $user_name);
$this->db->order_by("posts.post_id", "desc");
$query = $this->db->get();
if ($query->num_rows() > 0):
return $query;
else:
return FALSE;
endif;
}
Header will not load and home_view stops just before displaying records.