title: Can't insert data in mysql database
body: <p>i can't complete signup, cause the data is not inserted in the database. please help me
  Any help will be helpful. thank you so much</p>
  
  <pre><code>&lt;?php
  //signup.php
  include 'connect.php';
  include 'header.php';
  
  
  if($_SERVER['REQUEST_METHOD'] != 'POST')
  { 
  /*the form hasn't been posted yet, display it
    note that the action="" will cause the form to post to the same page it is on */
  echo '&lt;table&gt;&lt;th&gt;&lt;center&gt;&lt;h2&gt;Sign Up&lt;/h2&gt;&lt;/center&gt;&lt;/th&gt;&lt;tr&gt;&lt;td&gt;&lt;form method="post" action=""&gt;
      &lt;input type="text" name="user_idnum" placeholder = "ID Number"/&gt;&lt;br&gt;&lt;br&gt;
      &lt;input type="text" name="user_lname" placeholder = "Lastname"/&gt;&lt;br&gt;&lt;br&gt;
      &lt;input type="text" name="user_fname" placeholder = "Firstname"/&gt;&lt;br&gt;&lt;br&gt;
      &lt;input type="password" name="user_pass" placeholder = "Password"&gt;&lt;br&gt;&lt;br&gt;
      &lt;input type="password" name="user_pass_check" placeholder = "Re-enter Password"&gt;&lt;br&gt;&lt;br&gt;
      &lt;input type="email" name="user_email" placeholder = "Email"&gt;&lt;br&gt;&lt;br&gt;
      &lt;input type="submit" value="Sign Up" /&gt;
   &lt;/form&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;';
  
  }
  else
  {
  /* so, the form has been posted, we'll process the data in three steps:
      1.  Check the data
      2.  Let the user refill the wrong fields (if necessary)
      3.  Save the data 
  */
  $errors = array(); /* declare the array for later use */
  
  if(isset($_POST['user_idnum']))
  {
  if(strlen($_POST['user_idnum']) &gt; 10)
      {
          $errors[] = 'The ID number cannot be longer than 10 characters.';
      }
  
  
  }
  else
  {
      $errors[] = 'The ID number field must not be empty.';
  }
  
  if(isset($_POST['user_pass']))
  
  {
      if($_POST['user_pass'] != $_POST['user_pass_check'])
      {
          $errors[] = 'The two passwords did not match.';
      }
  }
  else
  {
      $errors[] = 'The password field cannot be empty.';
  }
  
  if(!empty($errors)) /*check for an empty array, if there are errors, they're in this array (note            the ! operator)*/
  {
      echo 'Please input correct information...';
      header ("refresh:3;url=signup.php" );
  }
  else
  {
      //the form has been posted without, so save it
      //notice the use of mysql_real_escape_string, keep everything safe!
      //also notice the sha1 function which hashes the password
      $sql = "INSERT INTO
      users(user_pass, user_email ,user_date, user_level, user_lname, user_fname,   user_idnum)
              VALUES('" . mysql_real_escape_string($_POST['user_idnum']) . "',
                     '" . sha1($_POST['user_pass']) . "',
                     '" . mysql_real_escape_string($_POST['user_email']) . "',
                      NOW(),
                      0)";
  
      $result = mysqli_query($con, $sql);
      if(!$result)
      {
          //something went wrong, display the error
          echo 'Something went wrong while registering. Please try again later.';
          header ("refresh:3;url=signup.php" );
  
      }
      else
      {
          echo 'Successfully registered. You can now &lt;a href="signin.php"&gt;Sign in&lt;/a&gt;';
      }
  }
  }
  
  
  ?&gt;
  </code></pre>
  
  <p>i don't know what is wrong, all i can see after i clicked the Sign up button is always "Something went wrong while registering. Please try again later."
  please help me, i need this to complete my project. thankyou</p>