title: Mysqli Procedural Insert Into Table not working
body: <p>I am trying to insert into a table with Procedural Mysqli. It is not posting any errors nor is it posting the information to the database. Here is my code:</p>
  
  <pre><code>$query = "INSERT INTO Accounts (FirstName, LastName, Username, Password, Access) VALUES ({$_POST['FirstNameTbx']}, {$_POST['LastNameTbx']}, {$_POST['UsernameTbx']}, {$_POST['PasswordTbx']}, {$_POST['AccessDDL']})";
          mysqli_query($link, $query);
          mysqli_close($link);
          $Error .= "$query";
  </code></pre>
  
  <p>Update:
  I changed to prepared statement, now I am getting: </p>
  
  <p>Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of elements in type definition string doesn't match number of bind variables in /home/bryantrx/public_html/ec/add_user.php on line 19</p>
  
  <p>There are only 5 variables that need to be bound, and the UserID auto increments, so it doesn't need to be bound or referenced in the statement.. </p>
  
  <pre><code>if ($stmt = $link-&gt;prepare("INSERT INTO Accounts (FirstName, LastName, Username, Password, Access) VALUES (?, ?, ?, ?, ?)")){
              $stmt-&gt;bind_param($_POST['FirstNameTbx'], $_POST['LastNameTbx'], $_POST['UsernameTbx'], $_POST['PasswordTbx'], $_POST['AccessDDL']);
              $stmt-&gt;execute();   
              $Error .= "success";
              $stmt-&gt;close();
          } else {
              echo $link-&gt;error;
          }
  </code></pre>