更新 ci_session 时数据库出错?我正在使用多个数据库?
Database Error while updating the ci_session? I am using mulitiple Database?
Error Number: 1146
Table buz85ftp_buzoonga2.ci_sessions
doesn't exist
UPDATE `ci_sessions` SET `last_activity` = 1468474888, `user_data` = 'a:11:{s:9:\"user_data\";s:0:\"\";s:6:\"userid\";s:3:\"670\";s:5:\"phone\";s:10:\"9956451235\";s:7:\"emailid\";s:15:\"tester@test.com\";s:4:\"name\";s:6:\"Tester\";s:8:\"usertype\";s:1:\"1\";s:16:\"user_country_ref\";s:3:\"673\";s:12:\"user_country\";s:1:\"0\";s:9:\"time_zone\";s:12:\"Asia/Kolkata\";s:14:\"user_logged_in\";b:1;s:17:\"flash:new:success\";s:56:\"
Message(s) deleted
\";}' WHERE session_id
= 'f171da0c9be6fa5eb8d32905c8e1251b'
Filename: libraries/Session.php
Line Number: 288
function sess_write()
{
// Are we saving custom data to the DB? If not, all we do is update the cookie
if ($this->sess_use_database === FALSE)
{
$this->_set_cookie();
return;
}
// set the custom userdata, the session data we will set in a second
$custom_userdata = $this->userdata;
$cookie_userdata = array();
// Before continuing, we need to determine if there is any custom data to deal with.
// Let's determine this by removing the default indexes to see if there's anything left in the array
// and set the session data while we're at it
foreach (array('session_id','ip_address','user_agent','last_activity') as $val)
{
unset($custom_userdata[$val]);
$cookie_userdata[$val] = $this->userdata[$val];
}
// Did we find any custom data? If not, we turn the empty array into a string
// since there's no reason to serialize and store an empty array in the DB
if (count($custom_userdata) === 0)
{
$custom_userdata = '';
}
else
{
// Serialize the custom data array so we can store it
$custom_userdata = $this->_serialize($custom_userdata);
}
// Run the update query
$this->CI->db->where('session_id', $this->userdata['session_id']);
$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_data' => $custom_userdata));
// Write the cookie. Notice that we manually pass the cookie data array to the
// _set_cookie() function. Normally that function will store $this->userdata, but
// in this case that array contains custom data, which we do not want in the cookie.
$this->_set_cookie($cookie_userdata);
}
创建一个名为 ci_sessions
的 table 然后再试一次
$this->CI->load->database('databasename', TRUE);
Error Number: 1146
Table
buz85ftp_buzoonga2.ci_sessions
doesn't exist
UPDATE `ci_sessions` SET `last_activity` = 1468474888, `user_data` = 'a:11:{s:9:\"user_data\";s:0:\"\";s:6:\"userid\";s:3:\"670\";s:5:\"phone\";s:10:\"9956451235\";s:7:\"emailid\";s:15:\"tester@test.com\";s:4:\"name\";s:6:\"Tester\";s:8:\"usertype\";s:1:\"1\";s:16:\"user_country_ref\";s:3:\"673\";s:12:\"user_country\";s:1:\"0\";s:9:\"time_zone\";s:12:\"Asia/Kolkata\";s:14:\"user_logged_in\";b:1;s:17:\"flash:new:success\";s:56:\"
Message(s) deleted
\";}' WHERE
session_id
= 'f171da0c9be6fa5eb8d32905c8e1251b'Filename: libraries/Session.php
Line Number: 288
function sess_write()
{
// Are we saving custom data to the DB? If not, all we do is update the cookie
if ($this->sess_use_database === FALSE)
{
$this->_set_cookie();
return;
}
// set the custom userdata, the session data we will set in a second
$custom_userdata = $this->userdata;
$cookie_userdata = array();
// Before continuing, we need to determine if there is any custom data to deal with.
// Let's determine this by removing the default indexes to see if there's anything left in the array
// and set the session data while we're at it
foreach (array('session_id','ip_address','user_agent','last_activity') as $val)
{
unset($custom_userdata[$val]);
$cookie_userdata[$val] = $this->userdata[$val];
}
// Did we find any custom data? If not, we turn the empty array into a string
// since there's no reason to serialize and store an empty array in the DB
if (count($custom_userdata) === 0)
{
$custom_userdata = '';
}
else
{
// Serialize the custom data array so we can store it
$custom_userdata = $this->_serialize($custom_userdata);
}
// Run the update query
$this->CI->db->where('session_id', $this->userdata['session_id']);
$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_data' => $custom_userdata));
// Write the cookie. Notice that we manually pass the cookie data array to the
// _set_cookie() function. Normally that function will store $this->userdata, but
// in this case that array contains custom data, which we do not want in the cookie.
$this->_set_cookie($cookie_userdata);
}
创建一个名为 ci_sessions
的 table 然后再试一次
$this->CI->load->database('databasename', TRUE);