title: Using named parameters with PDO for LIKE
body: <p>I am trying to search the <code>name</code> field in my database using <code>LIKE</code>. If I craft the SQL 'by hand` like this:</p>
  
  <pre><code>$query = "SELECT * \n"
          . "FROM `help_article` \n"
          . "WHERE `name` LIKE '%how%'\n"
          . "";
  $sql = $db-&gt;prepare($query);
  $sql-&gt;setFetchMode(PDO::FETCH_ASSOC);
  $sql-&gt;execute();
  </code></pre>
  
  <p>Then it will return relevant results for 'how'.<br>
  However, when I turn it into a prepared statement:</p>
  
  <pre><code>$query = "SELECT * \n"
          . "FROM `help_article` \n"
          . "WHERE `name` LIKE '%:term%'\n"
          . "";
  $sql-&gt;execute(array(":term" =&gt; $_GET["search"]));
  $sql-&gt;setFetchMode(PDO::FETCH_ASSOC);
  $sql-&gt;execute();
  </code></pre>
  
  <p>I am always getting zero results. </p>
  
  <p>What am I doing wrong? I am using prepared statements in other places in my code and they work fine.</p>