Search code examples
codeignitercodeigniter-3

Codeigniter: Database driver is not currently loaded


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: https://i.imgur.com/aXFkCJ8.jpg

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.


Solution

  • 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); // always check the difference between hyphen and underscore when calling functions
    

    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.