title: Error:sqlstate[hy093]: invalid parameter number
body: <p>I can convert the echo'ed output in to an SQL statement that executes in phpMyAdmin going...</p>
  
  <p><strong>From this:</strong></p>
  
  <blockquote>
    <p>INSERT INTO crumbs (ip_address,ip_address_2,device_info,user_id,connections) VALUES(?,?,?,?,?)Value:'00.000.000.000', '00.000.000.000', 0,0000, 1</p>
  </blockquote>
  
  <p><strong>Into this:</strong></p>
  
  <blockquote>
    <p>INSERT INTO crumbs (ip_address,ip_address_2,device_info,user_id,connections) VALUES('00.000.000.000', '00.000.000.000', 0,0000, 1)</p>
  </blockquote>
  
  <p>It inserts the data in to the DB, no errors, however it executes through PHP-PDO... </p>
  
  <p><strong>With:</strong></p>
  
  <blockquote>
    <p>SQLSTATE[HY093]: Invalid parameter number</p>
  </blockquote>
  
  <p><strong>The code:</strong></p>
  
  <pre><code>        $columns = '('.implode(',', array_keys($user_connection)).''.",user_id,connections)";
          $inserts="(".implode(',',array_fill(0,count($user_connection)+2, '?')).")";
          $values = implode(', ',($user_connection)).",$user_id, 1";
  
          $sql_insert = "INSERT INTO crumbs ".$columns." VALUES".$inserts;
          $stmt = $this-&gt;_db-&gt;prepare($sql_insert);
          $stmt-&gt;execute(array($values)); 
  </code></pre>
  
  <p><strong>Edit-Adding $user_connection</strong></p>
  
  <pre><code>$user_connection [ 'ip_address'] = "'".$_SERVER['REMOTE_ADDR']."'";
  $user_connection [ 'ip_address_2']="'".$_SERVER['HTTP_X_FORWARDED_FOR']."'";
  $user_connection ['device_info']=0;
  </code></pre>
  
  <p>The error occurs during the execution of the SQL code. I've gone over all the examples and found nothing that's equivalent, I'm thinking it's something simple I'm missing (a rule?) since the code executes locally.</p>