Welcome Guest, Not a member yet? Register   Sign In
SESSION: ci_sessions database table not populating

I've been pulling my hair out over this for days. I posted a similar post earlier but it wasn't laid out properly i think. I really need detailed information on how to proceed instead of hints on where the look please.

First of all i downloaded 3.0.1 and built some simple pages from scratch to see if i could get sessions working.

Basically i set sessions in config to be database, and i set the database name as ci_sessions. I load the ci_sessions table. When i go to autoload sessions, when user starts using the website (right now i'm running it locally using WAMP so i'm the only user), i get an error message whenever i load the page. Also, ci_sessions table in a_cfg database does not populate at all when i autoload 'session' or try loading a page that tries to set some session variables.

This is the error message:

A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET `last_activity` = 1442580701, `user_data` = 'a:2:{s:9:\"user_data\";s:0:\"\"' at line 1

UPDATE SET `last_activity` = 1442580701, `user_data` = 'a:2:{s:9:\"user_data\";s:0:\"\";s:7:\"user_id\";i:1;}' WHERE `session_id` = 'd8ca004aaa0c4db687a91ae78d996afd'

Filename: libraries/Session.php

Line Number: 289

SOMEBODY indicated it might have something to do with "Filename: libraries/Session.php" but did not say what so i had no idea how to fix it.

It looks like its trying to write information to the PREVIOUS version of ci_sessions table based on the column names. No idea why its doing this as i started coding from 3.0.1 and system file is as it should be with no changes.

Here is the view that tries to set the session variable that triggers the error whenever the view loads:


Hey Test 1


$arr = array('user_id' => 1);



Here is the database file in config->database.php:

$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
'dsn' => '',
'hostname' => '',
'username' => 'xxx',
'password' => 'xxx',
'database' => 'a_cfg',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE

The ci_sessions table is found in the a_cfg database.

And here is the sessions configuration in config.php

$config['encryption_key'] = '123';

$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;

Please I'm desperate for help. Please be detailed as i am a self-taught coder that is very simplistic. Thanks in advance, Geoff

Messages In This Thread
SESSION: ci_sessions database table not populating - by gloosemore - 09-18-2015, 06:11 AM

Theme © iAndrew 2016 - Forum software by © MyBB