Welcome Guest, Not a member yet? Register   Sign In
Anotehr Session issue with 2.03

I use 2 databases. One is the default database (pndb) and one is called www1. These are defined as:

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '';
$db['default']['password'] = '';
$db['default']['database'] = 'pnet';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'latin1_swedish_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

$db['pndb']['hostname'] = 'localhost';
$db['pndb']['username'] = '';
$db['pndb']['password'] = '';
$db['pndb']['database'] = 'www1';
$db['pndb']['dbdriver'] = 'mysql';
$db['pndb']['dbprefix'] = '';
$db['pndb']['pconnect'] = TRUE;
$db['pndb']['db_debug'] = TRUE;
$db['pndb']['cache_on'] = FALSE;
$db['pndb']['cachedir'] = '';
$db['pndb']['char_set'] = 'utf8';
$db['pndb']['dbcollat'] = 'latin1_swedish_ci';
$db['pndb']['swap_pre'] = '';
$db['pndb']['autoinit'] = TRUE;
$db['pndb']['stricton'] = FALSE;

In my connection model constructor, I define them like this:

// Call the Model constructor
$this->db = $this->load->database('default', TRUE);
$this->pndb = $this->load->database('pndb', TRUE);

What happens is that I connect to pndb to align user data. After logging in, I set session variables. But I get this error...

Table 'www1.CI_sessions' doesn't exist

Filename: libraries/Session.php

But CI_sessions does exit in the other, default database, not www1. Session.php references $this-db which should point to the default, not the one I defined as pndb.

My question is , why does $this->db suddenly point to the incorrect database? If I had just referenced $this->pndb (as in my example) and then the system tries to update the database, would it assume the current database?

FIXED: This only happens when you use the same user to connect to both databases. When I created a separate user for the second database, it started working again. Is this a CI bug?

Messages In This Thread
Anotehr Session issue with 2.03 - by El Forum - 10-08-2011, 08:58 PM

Theme © iAndrew 2016 - Forum software by © MyBB