title: PDO :: bind variable with LIKE
body: <p>Can anyone help me</p>
  <p>This works fine ::</p>
  <pre><code>            $stmt = $this-&gt;conn-&gt;prepare(&quot;SHOW TABLES FROM db LIKE 'xyz'&quot;); //tablename hardcoded
              $stmt-&gt;execute();
              $rows = $stmt-&gt;fetch(PDO::FETCH_ASSOC);  //fetchAll
              
  </code></pre>
  <p>However if I try to bind my table name, as it will be dynamic in my script ::</p>
  <pre><code>            $stmt = $this-&gt;conn-&gt;prepare(&quot;SHOW TABLES FROM db LIKE :tbl&quot;); //tablename hardcoded
              $tbl = &quot;xyz&quot;;
              $stmt-&gt;bindParam(&quot;:tbl&quot;, $tbl, PDO::PARAM_STR);
              
  </code></pre>
  <p>This gives error,</p>
  <pre><code>            $stmt = $this-&gt;conn-&gt;prepare(&quot;SHOW TABLES FROM cens LIKE ?&quot;);
              $tbl = &quot;xyz&quot;;
              $stmt-&gt;bindParam(1, $tbl, PDO::PARAM_STR);
  </code></pre>
  <p>This also gives error,</p>
  <p>Error is</p>
  <p>Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1' in /opt/lampp/htdocs/PDO/test.php:132
  Stack trace:</p>
  <h1>0 /opt/lampp/htdocs/PDO/test.php(132): PDO-&gt;prepare('SHOW TABLES FRO...')</h1>
  <p>I tried with quotes, both in query and in bind variable, but it didn't work</p>
  <p>I want to bind the table name,</p>