CodeIgniter session object cannot be found
My guess is you're trying to load a library from within a model which is not directly possible.Try instead:
public function __construct() { parent::__construct(); $CI =& get_instance(); //Loads the codeigniter base instance (The object your controller is extended from. & for php4 compatibility $CI->load->database(); $CI->load->library('session'); if (!is_null($CI->session->userdata('user'))) { ...