title: pdo prepared statements with wildcards
body: <p>I want to execute the following mysql query:</p>
  
  <pre><code>SELECT * FROM `gc_users` WHERE `name` LIKE '%anyname%'
  </code></pre>
  
  <p>I tried this without success:</p>
  
  <pre><code>$stmt = $dbh-&gt;prepare("SELECT * FROM `gc_users` WHERE `name` LIKE :name");
  $stmt-&gt;bindParam(':name', "%" . $name . "%");
  $stmt-&gt;execute();
  
  $stmt = $dbh-&gt;prepare("SELECT * FROM `gc_users` WHERE `name` LIKE '%:name%'");
  $stmt-&gt;bindParam(':name', $name);
  $stmt-&gt;execute();
  </code></pre>
  
  <p>So I ask you if it is possible to use the % wildcard with prepared statements.</p>
  
  <p>/edit</p>
  
  <p>Thank you. Its working with <code>bindValue</code>:</p>
  
  <pre><code>$stmt = $dbh-&gt;prepare("SELECT * FROM `gc_users` WHERE `name` LIKE :name");
  $stmt-&gt;bindValue(':name', '%' . $name . '%');
  $stmt-&gt;execute();
  </code></pre>