Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
232 views
in Technique[技术] by (71.8m points)

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

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:GitTengWebsitesystemlibrariesSession.php on line 201
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...