title: Error 1146 in codeigniter
body: <p>I am trying to insert data into my table called 'user' but I'm getting this error. I've set the database properly.</p>
  
  <blockquote>
    <p>A Database Error Occurred</p>
    
    <p>Error Number: 1146</p>
    
    <p>Table 'folwd.users' doesn't exist</p>
  </blockquote>
  
  <pre><code>SELECT * FROM (`users`) WHERE `username` = 'Pallavi123' LIMIT 1
  </code></pre>
  
  <blockquote>
    <p>Filename: C:\wamp\www\PhpProject1\system\database\DB_driver.php</p>
    
    <p>Line Number: 330</p>
  </blockquote>
  
  <p>The table named <code>users</code> doesn't exist at all.</p>
  
  <p>user_manager_controller:</p>
  
  <pre><code>public function register(){
          if($this-&gt;session-&gt;userdata('logged_in')){
              //user is already logged in
              redirect('profile');
              }else{
              //init
              //$data['country_list']=$this-&gt;config-&gt;item('um_country_list');
              $data['username']='';
  
              $data['firstname']='';
              //$data['secondname']='';
              $data['lastname']='';
                          $data['email']='';
              //$data['dateofbirth']='';
              //$data['default_country']=$this-&gt;config-&gt;item('um_default_country');
              //load rules
              $rules=$this-&gt;config-&gt;item('um_register_rules');
              //default msg
              $data['msg']=$this-&gt;lang-&gt;line('um_form_msg');
  
              if(isset($_POST['submit'])){
                  //the user has submitted the form
                  //get the user input
                  $data['username']=$this-&gt;input-&gt;post('username');
  
                  $data['firstname']=$this-&gt;input-&gt;post('firstname');
                  //$data['secondname']=$this-&gt;input-&gt;post('secondname');
                  $data['lastname']=$this-&gt;input-&gt;post('lastname');
                                  $data['email']=$this-&gt;input-&gt;post('email');
                  //$data['dateofbirth']=$this-&gt;input-&gt;post('dateofbirth');
                  //$data['default_country']=$this-&gt;input-&gt;post('country');
  
                  $this-&gt;form_validation-&gt;set_rules($rules);//check with the rules
                  if ($this-&gt;form_validation-&gt;run() === FALSE){
                      //validation failed
                      $data['msg']=$this-&gt;lang-&gt;line('um_form_error');
                      $this-&gt;load-&gt;view('user_register_form',$data);
                  }else{
                      //validation passed
                      $dbdata=array(
                          'username'=&gt;$this-&gt;input-&gt;post('username'),
  
                          'firstname'=&gt;$this-&gt;input-&gt;post('firstname'),
                          //'secondname'=&gt;$this-&gt;input-&gt;post('secondname'),
                          'lastname'=&gt;$this-&gt;input-&gt;post('lastname'),
                                              'email'=&gt;$this-&gt;input-&gt;post('email'),
                                                  'password'=&gt;$this-&gt;input-&gt;post('password'),
                          //'dateofbirth'=&gt;$this-&gt;input-&gt;post('dateofbith'),
                          //'country'=&gt;$this-&gt;input-&gt;post('country')
                      );
  
                      $this-&gt;user_manager-&gt;register_user($dbdata);
  
                      $data['msg']=$this-&gt;lang-&gt;line('um_form_activate');
  
                      //render the view
                      $this-&gt;load-&gt;view('um_msg',$data);
                  }
              }else{
                  //render the view
                  $this-&gt;load-&gt;view('user_register_form',$data);
              }
          }
      }
  </code></pre>
  
  <p>um_users_model</p>
  
  <pre><code>function register_user($dbdata){
      $this-&gt;db-&gt;insert('user', $dbdata);
      $this-&gt;db-&gt;last_query();
  }
  </code></pre>