title: Prepared statement with PDO and WHERE clause
body: <p>I am trying to complete my prepared statement which is using the PDO class. My specific problem is that I am for the sake of god not able to get the :val after the WHERE clause into quotes which are needed to fire the SQL statement. I have tried concating it and also the quote() function but nothing seems to work, I am pretty sure I am missing something little but I cant find it. The statement can't be the mistake because I tested it directly at my DB and it works.<br>
  Here is my code:</p>
  
  <pre><code>public function find($column, $value){
      $stmt = $this-&gt;connection-&gt;prepare("
          SELECT *
           FROM benutzer
           WHERE $column = :val
      ");
      //$stmt-&gt;bindParam(":col", $this-&gt;connection-&gt;quote($column), PDO::PARAM_STR);
      $stmt-&gt;bindValue(":val", $this-&gt;connection-&gt;quote($value), PDO::PARAM_STR);
      $stmt-&gt;execute();
      // Set the fetchmode to populate an instance of 'User'
      // This enables us to use the following:
      //     $user = $repository-&gt;find(1234);
      //     echo $user-&gt;firstname;
      $stmt-&gt;setFetchMode(PDO::FETCH_CLASS, 'User');
      return $stmt-&gt;fetch();
  }
  </code></pre>
  
  <p>EDIT: As I mentioned I haven't found a answer which FULLY satifies my needs. The problem is that I have tried all the different ways I have found at reliable communities but not a single one has worked for me.</p>