title: PDO mixing unnamed and named parameters
body: <p>I'm trying to use this for a basic search with pagination:</p>
  
  <pre><code>$construct = '? AND ? AND..';
  
  $query = $database-&gt;prepare('SELECT * FROM something WHERE something LIKE ' . $construct . ' LIMIT :offset, :results');
  </code></pre>
  
  <p>The only reason I'm mixing them is because unnamed parameters can't have int values because of a PHP bug apparently: <a href="https://bugs.php.net/bug.php?id=44639" rel="nofollow">https://bugs.php.net/bug.php?id=44639</a></p>
  
  <p>However if I don't mix them, how can I search for a variable amount of terms using bindings?</p>
  
  <p><strong>Update</strong></p>
  
  <p>After messing around with it I solved it more or less using named parameters and some loops:</p>
  
  <pre><code>    // build prepared statement
      $construct = '';
      for ($x = 0; $x &lt;= $searchArrayCount; $x++) {
          $construct .= ($x &lt; $searchArrayCount)
                      ? ":var$x OR name LIKE "
                      : ":var$x LIMIT :start, :perPage";
      }
  
      $query = $database-&gt;prepare('SELECT something FROM something WHERE name LIKE ' . $construct);
  
      // bind parameters
      for ($x = 0; $x &lt;= $searchArrayCount; $x++) {
          $searchArray[$x] = "%$searchArray[$x]%";
          $query-&gt;bindParam(":var$x", $searchArray[$x]);
      }
  
      $query-&gt;bindParam(':start', $searchArrayCount, PDO::PARAM_INT);
      $query-&gt;bindParam(':perPage', $perPage, PDO::PARAM_INT);
  </code></pre>
  
  <p>If there's a more optimal way of going about this I'd love to be informed.</p>