title: PDO Insert Error - execute(array());
body: <p>I'm  trying to do a registration system, and I'm getting this error:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught exception 'PDOException' with message
    'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
    error in your SQL syntax; check the manual that corresponds to your
    MySQL server version for the right syntax to use near
    ''=L&amp;myPRwgOSB?V_execute(Array) #1 {main} thrown in
    /home/<em>*</em>*/public_html/forum/register-cmd.php on line 58</p>
  </blockquote>
  
  <p>and I have no clue why. Here's the code: What's wrong with it? </p>
  
  <pre><code>&lt;?php
  include('./includes/connect.php');
  /* START VARIABLES */
  $submit = $_POST['submit'];
  
  $username = clean($_POST['username']);
  
  $email = clean($_POST['email']);
  $repeatedemail = clean($_POST['remail']);
  
  $password = clean($_POST['password']);
  $repeatedpassword = clean($_POST['rpassword']);
  
  $year = (int) $_POST['year'];
  $day = (int) $_POST['day'];
  $months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
  
  if(in_array(ucwords($_POST['month']), $months)) {
      $dob = $_POST['month'] . " " . $day . ", " . $year;
  } else {
      header('Location: register.php?error=nonexist');
  }
  
  $referrer = $_POST['referrer'];
  
  $recieve_emails = (int) $_POST['getemail'];
  $view_signatures = (int) $_POST['sig'];
  /* END VARIABLES */
  if(isset($username) &amp;&amp; isset($submit) &amp;&amp; isset($email) &amp;&amp; isset($repeatedemail) &amp;&amp; isset($password) &amp;&amp; isset($repeatedpassword) &amp;&amp; isset($year) &amp;&amp; isset($day) &amp;&amp; isset($_POST['month']) &amp;&amp; isset($recieve_emails) &amp;&amp; isset($view_signatures)) {
      if($email == $repeatedemail) {
          if($password == $repeatedpassword) {
              $check_user = $con-&gt;prepare("SELECT * FROM users WHERE username = :username");
              $check_user-&gt;execute(array(
                  ":username" =&gt; $username
              ));
              if($check_user-&gt;rowCount() == 1) {
                  header('Location: register.php?error=usernametaken');
              } else {
                  $check_email = $con-&gt;prepare("SELECT * FROM users WHERE email = :email");
                  $check_email-&gt;execute(array(
                      ":email" =&gt; $email
                  ));
                  if($check_email-&gt;rowCount() == 1) {
                      header('Location: register.php?error=emailtaken');
                  } else {
                      $salt = salt();
  
                      $hashedPassword = sha1($pepper . $password . $salt);
                      $insert = $con-&gt;prepare("INSERT INTO users ('username', 'password', 'salt', 'email', 'dob', 'recieve_emails', 'view_signatures') VALUES (:username, :password, :salt, :email, :dob, :recieve_emails, :view_signatures)");
                      $insert-&gt;execute(array(
                          ":username" =&gt; $username,
                          ":password" =&gt; $hashedPassword,
                          ":salt" =&gt; $salt,
                          ":email" =&gt; $email,
                          ":dob" =&gt; $dob,
                          ":recieve_emails" =&gt; $recieve_emails,
                          ":view_signatures" =&gt; $view_signatures
                      ));
                      header('Location: index.php?success=registered');
                      exit();
                  }
              }
          } else {
              header('Location: register.php?error=nomatchpassword');
          }
      } else {
          header('Location: register.php?error=nomatchemail');
      }
  } else {
      header('Location: index.php');
  }
  ?&gt;
  </code></pre>