0

this is used to authenticate my users from accesing the views in this controller I keep getting this error when trying to access session data

---PHP Fatal error: Call to a member function userdata() on null in G:\PleskVhosts\apptcenter.com\control.apptcenter.com\application\controllers\tech.php on line 13 ----

I have tried loading the session library here and reinitializing my session(session_start()) but I keeps saying its is null or that im calling library() on null.

class tech extends CI_Controller {

function __construct() 
{


     $email = $this->session->userdata("activeEmail");
     $query = $db->query("SELECT * FROM tech WHERE Contains('email', $email)");

     if(empty($query))
     {
       redirect("Welcome/index");
     }

}
  • 2
    have you autoload session library? – umefarooq Oct 04 '18 at 05:24
  • Possible duplicate of [Codeigniter Call to a member function set\_userdata() on a non-object](https://stackoverflow.com/questions/8497052/codeigniter-call-to-a-member-function-set-userdata-on-a-non-object) – ShaH Dec 01 '18 at 22:53

0 Answers0