title: multiple database in codeigniter
body: <p>I'm trying to implement multiple database in CI. My code Is here:</p>
  
  <pre><code>//database.php
  $active_group = "default";
  $active_record = TRUE;
  
  $db['default']['hostname'] = "localhost";
  $db['default']['username'] = "root";
  $db['default']['password'] = "root";
  $db['default']['database'] = "ravelex";
  $db['default']['dbdriver'] = "mysql";
  $db['default']['dbprefix'] = "rvx_";
  $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['smf']['hostname'] = "localhost";
  $db['smf']['username'] = "root";
  $db['smf']['password'] = "root";
  $db['smf']['database'] = "smf";
  $db['smf']['dbdriver'] = "mysql";
  $db['smf']['dbprefix'] = "smf_";
  $db['smf']['pconnect'] = TRUE;
  $db['smf']['db_debug'] = TRUE;
  $db['smf']['cache_on'] = FALSE;
  $db['smf']['cachedir'] = "";
  $db['smf']['char_set'] = "utf8";
  $db['smf']['dbcollat'] = "utf8_general_ci";
  </code></pre>
  
  <p>The model is</p>
  
  <pre><code>//user_model.php
  class user_model extends Model {
      private $ravelex_db;
      function user_model() {
          parent::Model();
          $this-&gt;ravelex_db = $this-&gt;load-&gt;database('default', TRUE);
      }
  
      function find_all() {
          print_r($this-&gt;ravelex_db);
          $q = $this-&gt;ravelex_db-&gt;get('users');
          return $q-&gt;result();
      }
  }
  
  //smf_user_model.php
  class smf_user_model extends Model {
      private $smf_db;
  
      function smf_user_model() {
          parent::Model();
          $this-&gt;smf_db = $this-&gt;load-&gt;database('smf', TRUE);
      }
  
      function find_all() {
          $q = $this-&gt;smf_db-&gt;get('members');
          return $q-&gt;result();
      }
  }
  </code></pre>
  
  <p>Controller tester</p>
  
  <pre><code>    class mutipledb extends Controller {
  
      function mutipledb() {
          parent::Controller();
          $this-&gt;load-&gt;database();
          $this-&gt;load-&gt;model('user_model');
          $this-&gt;load-&gt;model('smf_user_model');
      }
  
      function index() {
          print_r($this-&gt;user_model-&gt;find_all());
          print_r($this-&gt;smf_user_model-&gt;find_all());
      }
  }
  </code></pre>
  
  <p>There are some error, The first database uses the second database name. But it still use it's prefix.</p>
  
  <p>The error is</p>
  
  <pre><code>A Database Error Occurred
  Error Number: 1146
  Table 'smf.rvx_users' doesn't exist
  SELECT * FROM (`rvx_users`)
  </code></pre>