title: PHP's PDO prepared statement: am I able to use one placeholder multiple times?
body: <p>I'd like to perform the following query:</p>
  
  <pre class="lang-php prettyprint-override">
      SELECT
        *,
        (SELECT COUNT(*) FROM `tab2` WHERE `parent` = <b>:id</b>) AS `sum`
      FROM `tab1`
      WHERE `id` = <b>:id</b>
  </pre>
  
  <p>As you can see <code>:id</code> placeholder appeared twice in the query. So if I'd try to execute this statement with:</p>
  
  <pre><code>$q-&gt;execute(['id'=&gt;$row_id]);
  </code></pre>
  
  <p>I'm receiving the error:</p>
  
  <pre><code>Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number
  </code></pre>
  
  <p>So I have to rewrite the prepared query and execute array with :id1 and :id2 placeholders which looks a bit stupid for me.</p>
  
  <p>Is it the only way to use one placeholder in several places of the prepared statement?</p>