2016-07-14 4 views
0

Номер ошибки: 1146Ошибка базы данных при обновлении ci_session? Я использую mulitiple Database?

buz85ftp_buzoonga2.ci_sessions Таблица не существует

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:\"[email protected]\";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:\" 

сообщение (s) удален

\ ";}» WHERE session_id = 'f171da0c9be6fa5eb8d32905c8e1251b'

Filename: libraries/Session.ph р

Порядковый номер: 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); 
    } 
+0

При удалении записи я получаю эту ошибку. Данные удаляются, но им приходится сталкиваться с этой ошибкой? –

+0

База данных buz85ftp_buzoonga2 не содержит таблицы ci_sessions. Вам нужно создать таблицу вручную. Подробнее читайте в разделе [драйвер базы данных] (http://www.codeigniter.com/userguide3/libraries/sessions.html#database-driver) в документах. –

+0

ci_sessions существует в базе данных buz85ftp_buzoonga1. Я хочу переключить базу данных. –

ответ

0

$ this-> CI-> load-> база данных ('имя_базы_данных', TRUE);

0

Создать таблицу с именем ci_sessions затем повторите попытку

+0

ci_sessions существует в базе данных buz85ftp_buzoonga1. Я хочу переключить базу данных :( –

+0

'buz85ftp_buzoonga1' должен быть вашей базой данных по умолчанию, поэтому CI сможет получить к нему доступ через' $ this-> db'. Для доступа к другой базе данных вы можете создать новое соединение, подобное этому '$ DB1 = $ this-> load-> database ('group_one', TRUE); 'Кроме того, вы можете использовать существующее соединение и базу данных переключателей, как этот' $ this-> db-> db_select ('<имя вашей базы данных>') ; ' –

 Смежные вопросы

  • Нет связанных вопросов^_^