title: PHP PDO "select like" query
body: <p>I'm trying to bind two parameters to a prepared PDO select statement. This is what I have so far:</p>
  
  <pre><code>$query = "select * from books where ? LIKE ?";
  $result = $db-&gt;prepare($query);
  $result-&gt;bindValue(1, $searchTerm, PDO::PARAM_STR);
  $result-&gt;bindValue(2, "%$searchValue%", PDO::PARAM_STR);
  $result-&gt;execute();
  $rows = $result-&gt;fetchAll(PDO::FETCH_ASSOC);
  print_r($rows);
  </code></pre>
  
  <p>This executes successfully but I don't get any rows returned.</p>
  
  <p>But when I use only 1 param</p>
  
  <pre><code>$query = "select * from books where title LIKE ?";
  $result-&gt;bindValue(1, "%$searchValue%", PDO::PARAM_STR);
  </code></pre>
  
  <p>I get rows returned. I've checked 1000 times for my param values and names and they are fine.</p>
  
  <p>I don't understand why this doesn't work with two params. Please advice.</p>