title: Error when attempting to connect to a non-default database in Codeigniter
body: <p>Here is my database configuration for the database I'm attempting to connect to. It is different for this particular model.</p>
  
  <pre><code>$db['campaignsDB']['hostname'] = 'localhost';
  $db['campaignsDB']['username'] = 'root';
  $db['campaignsDB']['password'] = '';
  $db['campaignsDB']['database'] = 'sf_campaigns';
  $db['campaignsDB']['dbdriver'] = 'mysql';
  $db['campaignsDB']['dbprefix'] = '';
  $db['campaignsDB']['pconnect'] = TRUE;
  $db['campaignsDB']['db_debug'] = TRUE;
  $db['campaignsDB']['cache_on'] = FALSE;
  $db['campaignsDB']['cachedir'] = '';
  $db['campaignsDB']['char_set'] = 'utf8';
  $db['campaignsDB']['dbcollat'] = 'utf8_general_ci';
  $db['campaignsDB']['swap_pre'] = '';
  $db['campaignsDB']['autoinit'] = TRUE;
  $db['campaignsDB']['stricton'] = FALSE;
  </code></pre>
  
  <p>I have created a crud_model and I'm sure the functions are written right, but I'm going to include the relevant part...</p>
  
  <pre><code>class CRUD_model extends CI_Model
  {
      protected $database = null;
      protected $_table = null;
      protected $_primary_key = null;
  
      public function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;database($this-&gt;database, TRUE);
      }
  </code></pre>
  
  <p>What I'm having a problem with is as follows:</p>
  
  <p>I create a campaigns_model...</p>
  
  <pre><code>class Campaigns_model extends CRUD_model
  {
      protected $database = "campaignsDB"; //DEFINE database
      protected $_table = "camp_forminfo";
      protected $_primary_key = "form_id";
  
      public function __construct()
      {
          parent::__construct();
      }
  }
  </code></pre>
  
  <p>Now I'm returning to object oriented programming after a long hiatus so it could be that I'm missing some important part here, but I could have sworn that by defining a variable of a base class in a derived class it would thus be defined when I try to use the base class' method. I attempt to use the CRUD_model's insert function in my controller...</p>
  
  <p>First I load the campaigns_model...</p>
  
  <pre><code>class Campaigns extends MY_Controller
  {
      private $layout = "";
      private $content = "";
  
      public function __construct()
      {
          parent::__construct($this-&gt;layout);
          $this-&gt;load-&gt;model('campaigns_model');  
      }
  </code></pre>
  
  <p>Then I use it in my controller function...</p>
  
  <pre><code>public function saveForm()
  {
      $this-&gt;campaigns_model-&gt;insert([
          'form_name' =&gt; $this-&gt;input-&gt;post('form_name'),
          'form_leads' =&gt; $this-&gt;input-&gt;post('form_leads'),
          'form_content' =&gt; $this-&gt;input-&gt;post('form_content'),
          'form_template' =&gt; $this-&gt;input-&gt;post('form_template')  
      ]);
  }
  </code></pre>
  
  <p>I get the following error: </p>
  
  <pre><code>An Error Was Encountered
  
  You have not selected a database type to connect to.
  </code></pre>