CodeIgniter Forums
Codeigniter session doesn't store session data with using database - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: Codeigniter session doesn't store session data with using database (/showthread.php?tid=1011)



Codeigniter session doesn't store session data with using database - Vimal - 02-05-2015

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');
 
   



RE: Codeigniter session doesn't store session data with using database - Avenirer - 02-05-2015

$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/sessions-with-database-in-codeigniter/


RE: Codeigniter session doesn't store session data with using database - Vimal - 02-06-2015

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


RE: Codeigniter session doesn't store session data with using database - Narf - 02-06-2015

(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


RE: Codeigniter session doesn't store session data with using database - Avenirer - 02-06-2015

(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...


RE: Codeigniter session doesn't store session data with using database - Vimal - 02-06-2015

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