Fatal error: Call to undefined method CI_DB_pdo_driver::where() in

烂漫一生 提交于 2019-12-26 08:52:15

问题


I’m using PDO driver to access MySQL database. Everything is working OK on that part. My database.php looks like this:

$active_group = 'default';
$active_record = FALSE;

$db['default']['hostname'] = 'mysql:host=127.0.0.1:3386';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'mydatabase';
$db['default']['dbdriver'] = 'pdo';
$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'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE; 

I don’t use Active Record..

The problem occurred when I auto-loaded session library and set it to use database. I created table in my database, and on first visit to site, a record gets inserted into session table. No problem there. An error occurs on subsequent visits to the site. I’m getting following:

Fatal error: Call to undefined method CI_DB_pdo_driver::where() in P:\Git\TengWebsite\system\libraries\Session.php on line 201

回答1:


set $active_record = TRUE;

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

Note: that some CodeIgniter classes such as Sessions require Active Records be enabled to access certain functionality.

its clearly stated here CodeIgniter Doc



来源:https://stackoverflow.com/questions/19114403/fatal-error-call-to-undefined-method-ci-db-pdo-driverwhere-in

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!