CodeIgniter Forums
Help with sessions? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Help with sessions? (/thread-7113.html)



Help with sessions? - El Forum - 03-25-2008

[eluser]JasonS[/eluser]
I want to create this.

session_start();

$_SESSION['access'] = $access;

I believe I have the second part down.

Am I right in thinking that this will set the session 'access'?

$this->session->userdata('access') = $access;

If that is right, is session_start on by default?


Help with sessions? - El Forum - 03-25-2008

[eluser]GSV Sleeper Service[/eluser]
CI sessions are different to standard PHP sessions.

When using CI sessions you will not need to use session_start, but you will have to load or autoload the session Library.

you'd use this to set a CI session var
Code:
$this->session->set_userdata('access',$access)
and this to read it back
Code:
$access = $this->session->userdata('access')