title: codeigniter database error add
body: <p>A Database Error Occurred</p>
  
  <p>Error Number: 1146</p>
  
  <blockquote>
    <p>Table 'gtv.1tbpost' doesn't exist</p>
    
    <p>INSERT INTO <code>1tbpost</code> (<code>post_title</code>) VALUES ('')</p>
    
    <p>Filename: C:/xampp/htdocs/1/system/database/DB_driver.php</p>
    
    <p>Line Number: 691</p>
    
    <hr>
  </blockquote>
  
  <p><strong>database.php</strong>
  /</p>
  
  <pre><code>$active_group = 'default';
  $query_builder = TRUE;
  
  $db['default'] = array(
      'dsn'   =&gt; '',
      'hostname' =&gt; 'localhost',
      'username' =&gt; 'root',
      'password' =&gt; '',
      'database' =&gt; 'gtv',
      'dbdriver' =&gt; 'mysqli',
      'dbprefix' =&gt; '1',
      'pconnect' =&gt; FALSE,
      'db_debug' =&gt; (ENVIRONMENT !== 'production'),
      'cache_on' =&gt; FALSE,
      'cachedir' =&gt; '',
      'char_set' =&gt; 'utf8',
      'dbcollat' =&gt; 'utf8_general_ci',
      'swap_pre' =&gt; '',
      'encrypt' =&gt; FALSE,
      'compress' =&gt; FALSE,
      'stricton' =&gt; FALSE,
      'failover' =&gt; array(),
      'save_queries' =&gt; TRUE
  );
  </code></pre>
  
  <hr>
  
  <p><strong>model:</strong></p>
  
  <pre><code>public function add(){
              $data=array(
  
              'post_title'=&gt;$this-&gt;input-&gt;post('title'),
  
              );
          $this-&gt;db-&gt;insert('tbpost',$data);
          }
  </code></pre>
  
  <p><strong>controller:</strong></p>
  
  <pre><code>   public function add_validate(){
          $this-&gt;load-&gt;library('form_validation');
  
          $this-&gt;form_validation-&gt;set_rules('title', 'Title', 'trim|required|min_length[6]|regex_match[/^[A-Za-z0-9 .]+$/]');
          $this-&gt;form_validation-&gt;set_rules('image', 'Image', 'trim');
          $this-&gt;form_validation-&gt;set_rules('text', 'Text', 'trim|required|min_length[2]');
  
          $this-&gt;form_validation-&gt;set_message('required', '%s is required.');
          $this-&gt;form_validation-&gt;set_message('min_length', 'minimum characters for %s is %s');
          $this-&gt;form_validation-&gt;set_message('regex_match', '%s is not in the correct format');
  
          if($this-&gt;form_validation-&gt;run() == FALSE){
              if($this-&gt;input-&gt;post('add') == "post"){
                  $this-&gt;gtvmod-&gt;add();
              }else if($this-&gt;input-&gt;post('add') == "save"){
                  $this-&gt;index();
              }else if($this-&gt;input-&gt;post('add') == "cancel"){
                  $this-&gt;index();
              }else{
                  $this-&gt;index();
              }
  
          }else{
              if($this-&gt;input-&gt;post('add') == "post"){
                  $this-&gt;add();//punta model
              }else if($this-&gt;input-&gt;post('add') == "save"){
                  $this-&gt;index();//punta model
              }else if($this-&gt;input-&gt;post('add') == "cancel"){
                  $this-&gt;index();//punta model
              }else{
                  $this-&gt;index();//punta model
              }
          }
      }
  </code></pre>
  
  <hr>
  
  <p>problem I specify that my table is 'tbpost' but the error says that I insert into table '1tbpost' .</p>