Welcome Guest, Not a member yet? Register   Sign In
Session undefined
#1

[eluser]HooJee[/eluser]
Hi Guys

I am trying to retrieve a session from some of my views but I keep getting the following errors:

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Loader::$session

Filename: template/top.php

Line Number: 38

Fatal error: Call to a member function userdata() on a non-object in C:\wamp\www\personal\system\application\views\admin\template\top.php on line 38

Here is the code in the view:
Code:
<?php echo $this->session->userdata('last_login'); ?>

And here is how I set the session in the controller:
Code:
$sessiondata = array(
    'id'        => $user->row()->id,
    'last_login'  => $user->row()->last_login,
    'logged_in' => TRUE
);
$this->session->set_userdata($sessiondata);
#2

[eluser]darkhouse[/eluser]
Is the session library loaded at that point? I always autoload my session library.




Theme © iAndrew 2016 - Forum software by © MyBB