Welcome Guest, Not a member yet? Register   Sign In
custom session data
#1

[eluser]jorx[LINUX][/eluser]
hi guyz!!! I'm saving session data to mysql db---- is it possible to add custom data to the session array?!!!!!
#2

[eluser]Thorpe Obazee[/eluser]
Did you try $this->session->set_userdata('key', 'value');?
#3

[eluser]jorx[LINUX][/eluser]
yes...


i had use this sample query from the user guide

Code:
CREATE TABLE IF NOT EXISTS  `ci_sessions` (
session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(16) DEFAULT '0' NOT NULL,
user_agent varchar(50) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text NOT NULL,
PRIMARY KEY (session_id)
);

do i have to add an additional table(s) for the custom data?
#4

[eluser]riko0na[/eluser]
bargainph

"Most programmers are lazy. If you're like me, you're lazy too." from pinoytech.org

hehe..lol
#5

[eluser]Thorpe Obazee[/eluser]
[quote author="jorx[LINUX]" date="1247493965"]yes...


i had use this sample query from the user guide

Code:
CREATE TABLE IF NOT EXISTS  `ci_sessions` (
session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(16) DEFAULT '0' NOT NULL,
user_agent varchar(50) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text NOT NULL,
PRIMARY KEY (session_id)
);

do i have to add an additional table(s) for the custom data?[/quote]

That table is mostly what you'll need. No additional tables.
#6

[eluser]bigtony[/eluser]
The custom sesssion variables are put into the 'user_data' text field of the ci_sessions table.
#7

[eluser]jorx[LINUX][/eluser]
thankz guyz!!!!!!




Theme © iAndrew 2016 - Forum software by © MyBB