title: Codeigniter showing error: No database selected
body: <p>I am using Codeigniter's DBForge class to create a database and table within that database. </p>
  
  <p>Here is code:</p>
  
  <pre><code>if ($this-&gt;dbforge-&gt;create_database('new_db')) {
       $fields = array(
           'blog_id' =&gt; array(
                'type' =&gt; 'INT',
                'constraint' =&gt; 5,
                'unsigned' =&gt; TRUE,
                'auto_increment' =&gt; TRUE
            ),
            'blog_title' =&gt; array(
                'type' =&gt; 'VARCHAR',
                'constraint' =&gt; '100',
            ),
            'blog_author' =&gt; array(
                'type' =&gt; 'VARCHAR',
                'constraint' =&gt; '100',
                'default' =&gt; 'King of Town',
            ),
            'blog_description' =&gt; array(
                'type' =&gt; 'TEXT',
                'null' =&gt; TRUE,
            ),
       );
       $this-&gt;dbforge-&gt;add_field($fields);
       $this-&gt;dbforge-&gt;add_key('blog_id', TRUE);
       $this-&gt;dbforge-&gt;create_table('blog', TRUE);
  }
  </code></pre>
  
  <p>The above mentioned code is written inside index function of controller. When the following code is executed, it shows error as, <strong>No database selected</strong>. Does anyone have ant idea why it is happening. Any help is appreciated. </p>