title: My sql insert query works with no errors but does not insert anything into database
body: <p>I'm making a relatively easy login and register form to practice my web skills and I'm having issues with the PHP/SQL portion of the site I have a very simple form with email password username and full name options but whenever I fill in the form and click submit the query will be send with the posted data but it will not be added to the database. </p>
  
  <p>What does work if for example i have my <code>if(isset($POST["submitbutton"]))</code></p>
  
  <p>and I put an <code>!</code> in front of the <code>isset</code> the data WILL be sent into the database with no errors so this led me to believe something is wrong with my POST or submit button </p>
  
  <p>P.S: i have also tried using <code>print_r</code> and <code>var_dump</code>. Both gave me results such as this if i put <code>var_dump</code> BEFORE the <code>if(isset)</code> i get this, <code>array(4) { ["reg_username"]=&gt; string(3) "www" ["reg_password"]=&gt; string(3) "waw" ["reg_email"]=&gt; string(16) "test@hotmail.com" ["reg_fullname"]=&gt; string(3) "hhh" }</code></p>
  
  <p>If I put it after the POST nothing will be shown anymore </p>
  
  <p>This is my database connection file </p>
  
  <pre><code>&lt;?php   
  $host ="localhost";
  $user = "root";
  $password ="";
  $dbname="registerlogin";
  
  $conn =  mysqli_connect($host,$user,$password,$dbname) or die ($conn -&gt; error);
  
  $sql = "SELECT * FROM `users`";
  
  $sqlQuery = mysqli_query($conn,$sql);
  
  $query = array();
  
  while($row = mysqli_fetch_assoc($sqlQuery)){
      $query = $row;
  }
  ?&gt;
  </code></pre>
  
  <p>this is the register PHP file </p>
  
  <pre><code>&lt;?php
  include_once("db.php");
  
  if(isset($_POST["registerbutton"])){
  $username = mysqli_real_escape_string($conn,$_POST["reg_username"]);
  $hasedpassword = password_hash($_POST["reg_password"],PASSWORD_BCRYPT);
  $email = mysqli_real_escape_string($conn,$_POST["reg_email"]);
  $fullname = mysqli_real_escape_string($conn,$_POST["reg_fullname"]);
  
  $sqlInsert = "INSERT INTO `users` (`User-id`,`Username`,`Password`,`Email`,`Fullname`) VALUES (NULL,'$username','$hasedpassword','$email','$fullname')";
  
  if(!$conn){
      die("Error: ".mysql_error());
  }
  
  if (count($_POST) &gt; 0){
      mysqli_query($conn,$sqlInsert) or die($conn-&gt; error);
      $message = "Successfully registerd";
  } else{
      $message = "Something went wrong";
   }
  }   
  </code></pre>
  
  <p>And the HTML file </p>
  
  <pre><code>&lt;form method="POST" action="&lt;?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?&gt;"  id="register-form" class="text-left"&gt;
              &lt;div class="login-form-main-message"&gt;&lt;/div&gt;
              &lt;div class="main-login-form"&gt;
                  &lt;div class="login-group"&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="reg_username" class="sr-only"&gt;Email address&lt;/label&gt;
                          &lt;input type="text" class="form-control" id="reg_username" name="reg_username" placeholder="username"&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="reg_password" class="sr-only"&gt;Password&lt;/label&gt;
                          &lt;input type="password" class="form-control" id="reg_password" name="reg_password" placeholder="password"&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="reg_email" class="sr-only"&gt;Email&lt;/label&gt;
                          &lt;input type="text" class="form-control" id="reg_email" name="reg_email" placeholder="email"&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="reg_fullname" class="sr-only"&gt;Full Name&lt;/label&gt;
                          &lt;input type="text" class="form-control" id="reg_fullname" name="reg_fullname" placeholder="full name"&gt;
                      &lt;/div&gt;
  
                  &lt;/div&gt;
                  &lt;button type="submit" value="Submit form" name="registerbutton"&gt;&lt;i class="fa fa-chevron-right"&gt;&lt;/i&gt;&lt;/button&gt;
              &lt;/div&gt;
              &lt;div class="etc-login-form"&gt;
                  &lt;p&gt;already have an account? &lt;a href="#"&gt;login here&lt;/a&gt;&lt;/p&gt;
              &lt;/div&gt;
          &lt;/form&gt;
  </code></pre>