title: A Database Error Occurred Error Number: 1146 in codeigniter
body: <p>I am new to codeigniter where I tried form validation.</p>
  
  <p>Here is my View Code:</p>
  
  <pre><code>&lt;?php echo validation_errors(); ?&gt;
            &lt;?php echo form_open('enquiry'); ?&gt;
            &lt;table width="580" border="0" cellspacing="0" cellpadding="5"&gt;
  
              &lt;tr&gt;
                &lt;td height="30" align="right" valign="middle" class="normal-text-style"&gt; *Full Name:&lt;br /&gt;&lt;/td&gt;
                &lt;td height="30" align="left" valign="middle" class="normal-style"&gt;&lt;input type="text" name="name" value="&lt;?php echo set_value('name'); ?&gt;" class="textbox-style01" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td height="30" align="right" valign="middle" class="normal-text-style"&gt; *Company: &lt;span id="mndCompany"&gt; &lt;/span&gt;&lt;br /&gt;&lt;/td&gt;
                &lt;td height="30" align="left" valign="middle" class="normal-style"&gt;&lt;input type="text" name="company" value="&lt;?php echo set_value('company'); ?&gt;"  class="textbox-style01" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td height="30" align="right" valign="middle" class="normal-text-style"&gt; *E-mail:&lt;/td&gt;
                &lt;td height="30" align="left" valign="middle" class="normal-style"&gt;&lt;input type="text" name="email" value="&lt;?php echo set_value('email'); ?&gt;" class="textbox-style01" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td height="30" align="right" valign="middle" class="normal-text-style"&gt; *Phone: &lt;br /&gt;&lt;/td&gt;
                &lt;td height="30" align="left" valign="middle" class="normal-style"&gt;&lt;input type="text" name="phone" value="&lt;?php echo set_value('phone'); ?&gt;" class="textbox-style01" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td height="30" align="right" valign="middle" class="normal-text-style"&gt; *Fax: &lt;br /&gt;&lt;/td&gt;
                &lt;td height="30" align="left" valign="middle" class="normal-style"&gt;&lt;input type="text" name="fax" value="&lt;?php echo set_value('comments'); ?&gt;" class="textbox-style01" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td width="179" height="30" rowspan="2" align="right" valign="top" class="normal-text-style"&gt; *Comments: &lt;br /&gt;&lt;/td&gt;
                &lt;td width="421" height="12" align="left" valign="middle" class="normal-style"&gt;&lt;textarea  name="comments" class="msgebox-style01"&gt;&lt;?php echo set_value('comments'); ?&gt;&lt;/textarea&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td height="50" align="left" valign="top" class="normal-style"&gt;&lt;input type="image" name="submit" src=" &lt;?php echo base_url(); ?&gt;/public/images/submit01.png" alt="submit" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
            &lt;/table&gt;
            &lt;/form&gt;
  </code></pre>
  
  <p>And this is my controller</p>
  
  <pre><code>function index()
      {
          $this-&gt;form_validation-&gt;set_rules('name', 'Name', 'trim|required|xss_clean');
          $this-&gt;form_validation-&gt;set_rules('company', 'Company', 'trim|required|xss_clean');
          $this-&gt;form_validation-&gt;set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');
          $this-&gt;form_validation-&gt;set_rules('phone', 'phone', 'trim|required|xss_clean');
          $this-&gt;form_validation-&gt;set_rules('fax', 'fax', 'trim|required|xss_clean');
          $this-&gt;form_validation-&gt;set_rules('comments', 'comments', 'trim|required|xss_clean');
  
  
          $data['header_menu']=$this-&gt;load-&gt;view('header_menu', '', TRUE);
          $this-&gt;load-&gt;view('inner_header',$data);
          $data['left_menu']=$this-&gt;load-&gt;view('left_menu', '', TRUE);
  
          if ($this-&gt;form_validation-&gt;run() == FALSE)
          {
              $this-&gt;load-&gt;view('enquiry',$data);
          }
  
          else
          {
             $this-&gt;load-&gt;view('enquiry/formsucess',$data);   
          }    
          $this-&gt;load-&gt;view('footer');
          //$this-&gt;load-&gt;view('enquiry',$data);
  
  
      }
      function formsucess()
      {
  
  
          $name = $this-&gt;input-&gt;post('name');
          $company = $this-&gt;input-&gt;post('company');
          $email = $this-&gt;input-&gt;post('email');
          $phone = $this-&gt;input-&gt;post('phone');
          $fax = $this-&gt;input-&gt;post('fax');
          $comments = $this-&gt;input-&gt;post('comments');
          $this-&gt;db-&gt;query("INSERT INTO `st_enquiry` 
          (name, company,email,phone,fax,comments,status,created_on)
          VALUES
          ('$name','$company','$email','$phone','$fax','$comments','1',now())");
  
          $data['header_menu']=$this-&gt;load-&gt;view('header_menu', '', TRUE);
          $this-&gt;load-&gt;view('inner_header',$data);
          $data['left_menu']=$this-&gt;load-&gt;view('left_menu', '', TRUE);
          $this-&gt;load-&gt;view('media',$data);
          $this-&gt;load-&gt;view('footer');
  
  
      }
  </code></pre>
  
  <p>After submitting the form I got an error like:</p>
  
  <pre><code>A Database Error Occurred
  
  Error Number: 1146
  
  Table 'table.users' doesn't exist
  </code></pre>