Reputation: 61
Halu guys I have created the following session table in my database
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(40) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
`data` blob NOT NULL,
KEY `ci_sessions_timestamp` (`timestamp`)
);
and here is code in my controller
$data=array(
'username'=>$this->input->post('username'),
'is_logged_in'=> true
);
$this->session->set_userdata($data);
here is config.php
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_encrypt_cookie'] = 'TRUE';
$config['sess_use_database'] = 'TRUE';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['sess_match_useragent'] = 'TRUE';
but when I logged in, the data is not stored in data base what is wrong with the code? thank you for your support!!!!
Upvotes: 0
Views: 971
Reputation: 156
Change your config.php
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
I hope this help you...
Upvotes: 0
Reputation: 8964
Change this line in config.php
$config['sess_driver'] = 'files';
to this
$config['sess_driver'] = 'database';
Upvotes: 1