title: Call to a member function setFetchMode() on a non-object PDO
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5223304/pdo-database-access-where-title-title">PDO Database access WHERE title = $title</a>  </p>
  </blockquote>
  
  
  
  <p>Here is a sample of $message's content :</p>
  
  <blockquote>
    <p>String(108) "\n      cc je t'ai envoy� une invitation  A plus :p\n    "</p>
  </blockquote>
  
  <p>Here is the error message : </p>
  
  <blockquote>
    <p>Fatal error: Call to a member function setFetchMode() on a non-object
    in  B:\wamp\www\messages.php on line 101</p>
  </blockquote>
  
  <p>My request that doesn't work :</p>
  
  <pre><code>    $resultats = $connexion-&gt;query("SELECT * FROM messages WHERE message LIKE '%$message%'");
      $resultats-&gt;setFetchMode(PDO::FETCH_OBJ);
      $occurences= $resultats-&gt;rowCount();
  </code></pre>
  
  <p>Why does this one work? (I changed $message by a) :</p>
  
  <pre><code> $resultats = $connexion-&gt;query("SELECT * FROM messages WHERE message LIKE '%a%'");
          $resultats-&gt;setFetchMode(PDO::FETCH_OBJ);
          $occurences= $resultats-&gt;rowCount();
  </code></pre>