Once I was using sessions in codeigniter and got the above error "Call to a member function set_userdata() on a non-object. Later I fixed it and providing the same solution for it.
This error comes in codeigniter if you haven't loaded session library in your file or project. You can do it in two ways. You can either load the session library in the file itself or autoload session library in autoload.php
Load the session library in the file as follows:
$this->load->library('session');
Or you can autoload session library as follows:
$autoload['libraries'] = array('database', 'session');
This should fix your error.
No comments:
Post a Comment