title: Integer values in dynamic PDO query
body: <p>I'm trying to use a dynamic PDO query (add where clause to the query if the variable is true) but i have a problem with integers values, this is my code:</p>
  
  <pre><code>$params = array();
  $cond = array();
  
  $query = "SELECT value FROM `table`";
  
  if (!empty($firstname)) {
      $cond[] = "firstname = :fn";
      $params[':fn'] = $firstname;
  }
  if (!empty($lastname)) {
      $cond[] = "lastname = :ln";
      $params[':ln'] = $lastname;
  }
  if (count($cond)) {
      $query .= ' WHERE ' . implode(' AND ', $cond);
  }
  
  $query .= " LIMIT :min, :max";
  $params[':min'] = $min; // INTEGER VALUE
  $params[':max'] = $max; // INTEGER VALUE
  
  $stmt = $db-&gt;prepare($query);
  $stmt-&gt;execute($params);
  </code></pre>
  
  <p>The problem is that <code>PDOStatement::execute</code> treated all values as <code>PDO::PARAM_STR</code> and LIMIT need integer values.</p>
  
  <p>I tried with <code>PDOStatement::bindValue</code> using <code>PDO::PARAM_INT</code> parameter but i don't know how to use it in a dynamic query.</p>