Welcome Guest, Not a member yet? Register   Sign In
Codeigniter session doesn't store session data with using database
#1
Sad 
(This post was last modified: 02-06-2015, 04:25 AM by Vimal.)

my settings in config file
PHP Code:
$config['sess_driver'] = 'database';//'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'sessdata';//this is my table name
$config['sess_match_ip'] = TRUE;//FALSE;
$config['sess_time_to_update'] = 300;

$config['cookie_prefix'] = '';
$config['cookie_domain'] = '.';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE

My Controller
PHP Code:
public function index() {

 
       echo '<pre>';
 
       print_r($this->session->userdata());
 
       //print_r($_SESSION);
 
       echo '</pre>';
 
       $newdata = array(
 
           'username' => 'johndoe',
 
           'email' => '[email protected]',
 
           'logged_in' => TRUE
        
);

 
       $this->session->set_userdata($newdata);
 
       $this->load->view('welcome_message');
 
   
Reply
#2

$config['sess_save_path'] = 'sessdata';//NULL;//dbname - is NOT dbname but session table. Did you follow the steps in the manual? Also, you can try one of my tutorials: http://avenir.ro/codeigniter-tutorials/s...deigniter/
Reply
#3

i just removed "." from

PHP Code:
$config['cookie_domain'] = '';//here 

And everything works fine now.I don't Know whats the prob with it Wink
Reply
#4

(02-06-2015, 04:26 AM)Vimal Wrote: i just removed "." from


PHP Code:
$config['cookie_domain'] = '';//here 

And everything works fine now.I don't Know whats the prob with it Wink

That '.' is not a valid domain? Smile
Reply
#5

(02-06-2015, 04:26 AM)Vimal Wrote: i just removed "." from


PHP Code:
$config['cookie_domain'] = '';//here 

And everything works fine now.I don't Know whats the prob with it Wink

...And also you've changed your thread code...
Reply
#6

Because i know that was table name i just marked and commented this line. Smile
"'sessdata';//NULL;//dbname"
Reply




Theme © iAndrew 2016 - Forum software by © MyBB