Codeigniter: Database driver is not currently loaded

岁酱吖の 提交于 2019-12-13 03:21:35

问题


I got installed codeigniter 3 in a wampserver 3 with mysql, and the connection to the DB configured, and all is working well, models have connection and queries are returning data, however, when i'm using the profiler library, specially the function:

$this->output->enable_profiler(true);

It returns me the follow:

I just want to see the queries that were runned but is showing:

Database driver is not currently loaded

Any idea about how to solve this? It is like the profiler doesn't get that the DB is connected. If you need more information ask me about it and thanks.


回答1:


First of all this is completely necessary in the autoload.php:

 $autoload['libraries'] = array('database');

And as annotation, Codeigniter doesn't support to show the queries runned when calling

$this->output->enable-profiler(true); 

if you load the database connection on the CI_Model or any other model, it is completelly necessary loading the database connection over the controllers or main controller if want to see the queries runned.




回答2:


You must be load database Library in config/autoload.php

$autoload['libraries'] = array('database');

Hope this solution will usefull to you.



来源:https://stackoverflow.com/questions/53873791/codeigniter-database-driver-is-not-currently-loaded

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