title: PDO error: SQLSTATE[HY000]: General error: 2031
body: <p>I'm getting this annoying error and although I have an idea of why I'm getting it, I can't for the life of me find a solution to it.</p>
  
  <pre><code>if ($limit) {
     $sth-&gt;bindValue(':page', $page - 1, PDO::PARAM_INT);
     $sth-&gt;bindValue(':entries_per_page', $page * $entries_per_page, PDO::PARAM_INT);
  }
  
  $sth-&gt;execute($criteria);
  </code></pre>
  
  <p>Query contains placeholders (<code>:placeholder</code>). But to add those LIMIT placeholders, I need to use the manual method (<code>bindValue</code>) because otherwise the engine will turn them into strings.</p>
  
  <p>I'm not getting the Invalid number of parameters error, so all placeholders have been bound correctly (I assume).</p>
  
  <p>Query:</p>
  
  <pre><code>SELECT `articles`.*, `regional_municipalities`.`name` AS `regional_municipality_name`, 
         `_atc_codes`.`code` AS `atc_code`, `_atc_codes`.`name` AS `substance`
  FROM `articles`
  LEFT JOIN `_atc_codes`
  ON (`_atc_codes`.`id` = `articles`.`atc_code`)
  JOIN `regional_municipalities`
  ON (`regional_municipalities`.`id` = `articles`.`regional_municipality`)
  WHERE TRUE AND `articles`.`strength` = :strength
  GROUP BY `articles`.`id`
  ORDER BY `articles`.`id`
  LIMIT :page, :entries_per_page
  </code></pre>
  
  <p>All placeholder values reside in $criteria, except for the last two LIMIT, which I manually bind with <code>bindValue()</code>.</p>