title: Call to a member function setFetchMode() error
body: <p>I've been getting this error,</p>
  
  <blockquote>
    <p>"Fatal error: Call to a member function setFetchMode() on a non-object in C:\Users\Public\wamp\www\audiotextCSVUpload\modified.php on line 34". </p>
  </blockquote>
  
  <p>Can you please help me what is causing the error. In one of my computer, it is ok, but in our office, the error exists. Find below the code:</p>
  
  <pre><code>&lt;?php
  require_once 'dbconfig.php';
  
  try {
      $conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
  
      $sql = 'SELECT phone, last_name, first_names
              FROM contacts';
  
      $q = $conn-&gt;query($sql);
      $q-&gt;setFetchMode(PDO::FETCH_ASSOC);
  
  } catch (PDOException $pe) {
      die("Could not connect to the database $dbname :" . $pe-&gt;getMessage());
  }
  ?&gt;
  </code></pre>