1
我已經添加下面的一行從我的模型笨real_escape_string功能不能稱之爲
$this->db->close();
然後這個代碼給我一個錯誤
Severity: error --> Exception: Call to a member function real_escape_string() on boolean
任何意見或建議,將不勝感激。
更新:這裏是我使用的配置。主數據庫連接
$db['default'] = array(
'dsn' => '',
'hostname' => 'is my host address',
'username' => 'is my id',
'password' => 'is my password',
'database' => 'is my database name',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => APPPATH.'cache/db/',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
如果連接關閉沒有必要,則不要關閉數據庫連接。 – Bhavin
你能查詢任何對$ this-> db的東西嗎? – Antony
@Bhavin我添加了'$ this-> db-> close()',因爲有太多的睡眠過程,這是由於所需的工作完成後沒有斷開連接造成的,我想確保所有的連接都在它們關閉後關閉完成。 –