Welcome Guest, Not a member yet? Register   Sign In
how to use Saving Session Data to a Database
#1

[eluser]my9006ci[/eluser]
how to use a class session, and save it to the database session in accordance with user guide and how to save user_data and whether they can be used for the system log?
Please help the explanation and examples
#2

[eluser]pickupman[/eluser]
You use the same syntax when using the session library regardless of storage. It's your config file determines where the session is stored. Either way you use:
Code:
$this->session->set_userdata('some_key','This is a string'); //store a value in session
$this->session->userdata('some_key'); //returns 'This is a string';

$this->session->set_flashdata('some_key','Available on the next request page only'); //store a flash variable
$this->session->flashdata('some_key'); //returns 'Available on the next request page only');

Per the user guide you can also pass a multi-dimensional array to set_userdata($array) and the array keys become the session key identifiers, and the values become the text stored in session.




Theme © iAndrew 2016 - Forum software by © MyBB