Welcome Guest, Not a member yet? Register   Sign In
Why I can't retrieve data from session in CodeIgniter3?
#1
Photo 

Dear Codeigniter.

I've create new web app using Codeigniter3 and I have a problem on session data.

Issue 1: I can't retrieve any data from my session data although it existing in database.

Issue 2  Rows of session table automatically increase and never deleted although I enable sess_expire_on_close to True. And When I refresh pages in Firefox 4 rows of table session will increase the same time. so it will increase to more and more rows if my web pages refresh more and it will increase one by one if I refresh in Chrome browser.

Please check on my configure.

Code:
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'tb_session';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;

Please check on my attachment to see the increasing of rows when chrome and firefox refresh pages.

And I've also can retrieve any data from table session when I used this method 


Code:
$this->data['f'] = $this->session->userdata('email');


Attached Files Thumbnail(s)
       
Reply
#2

(This post was last modified: 06-11-2015, 02:33 AM by InsiteFX.)

For one, your session table doe's not match the CI session table!

PHP Code:
NySQL:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
 
       `idvarchar(40NOT NULL,
 
       `ip_addressvarchar(45NOT NULL,
 
       `timestampint(10unsigned DEFAULT 0 NOT NULL,
 
       `datablob NOT NULL,
 
       PRIMARY KEY (id),
 
       KEY `ci_sessions_timestamp` (`timestamp`)
); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB