I got this error and cant fix it help me please
Message: Trying to get property of non-object
Filename: controllers/auth.php
Line Number: 20
and this is my code: The line 20 starts at if ($user->mail){
if ($user->mail) {
$this->session->set_flashdata("Success","You Are now logged in");
$_SESSION['user_logged'] = TRUE;
$_SESSION['username']=$user->username;
}
else {
$this->session->set_flashdata("error", "No Account exists in Database");
}
}