CodeIgniter Loading Database Error

codeigniter, database, php

Solution

Use `$this->load->database();`

Instead of `$this->load->library('database');`

Problem

When using Codeigniter to load the database, I am getting the following error message in a simple file where I load the database: ``` An Error Was Encountered Unable to load the requested class: database ``` The controller for this code is called db.php, and the code for it is as follows: ``` <?php class Db extends MY_Controller { function __construct() { parent::__construct(); $this->load->library('database'); } public function index() {} } ``` I do not have the database loaded in to autoload.php. I also know that I have the correct database information in my config.php file. My CodeIgniter application is in a subdomain if that might cause any problems. Any ideas on what could be causing the problem? Thanks.

Original source