title: PHP PDO Dynamic query builder class
body: <p>I'm writing a class to generate dynamic SQL insert query. I've created a test table    that has seven columns if I consider also the id that is an auto increment value otherwise the values are only six. I've tried to test if the insert function I've write works, but the console log me an error that is regarding the numbers of bounded variables: <code>PHP Warning:  PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens</code>.
  Usually I use to write my query and this is the first time that I get this error. Is it possible that I need to include also the id column field in the query?
  Here is the code:</p>
  
  <p>Test page</p>
  
  <pre><code>&lt;?php
  $dataManager = new DataManager($db);
  
  $table = 'hats_info';
  $data = array('test0','test1','test2','test3','test4','test5');
  $columns = array('materialA','materialB','materialC','materialD','accessories','hat_image');
  $holders = array('?','?','?','?','?','?');
  
  echo $dataManager-&gt;insert($data, $table, $columns, $holders);
  
  ?&gt; 
  </code></pre>
  
  <p>Class method code </p>
  
  <pre><code>&lt;?php 
  
  public function insert($table, array $data, array $columns , array $holders){
  
      $columns = implode(', ', array_values($columns));
      $holders = implode(', ', array_values($holders));
      $values = implode(', ', array_values($data));
  
      $stmt = $this-&gt;db-&gt;prepare("INSERT INTO $table ($columns) VALUES ($holders)");
      return $stmt-&gt;execute(array($values));
  }
  
  ?&gt;
  </code></pre>