title: PDO SQLite difficulties
body: <p>Could someone please tell me what is wrong with my code.  When I try to use the function, I get:</p>
  
  <pre><code>Fatal error: Call to a member function setFetchMode() on a non-object in ...
  </code></pre>
  
  <p>Using: </p>
  
  <pre><code>if (!$IDq) { print_r($dbh-&gt;errorInfo()); } 
  </code></pre>
  
  <p>gives me:
  file is encrypted or is not a database</p>
  
  <p>I have been messing with it for ages but can't seem to get it to work.</p>
  
  <pre><code>function user_registered($user_id){
  $dbh = new PDO("sqlite:datastore/userids.db");
  $IDq = $dbh-&gt;query("SELECT * FROM users_identify WHERE identifier = '$user_id'");
  $IDq-&gt;setFetchMode(PDO::FETCH_ASSOC);
  $IDf = $IDq-&gt;fetch();
  if($IDf['id']){
  return $IDf['id'];
  }else{
  return 0;
  }
  }
  </code></pre>
  
  <p>Thanks.</p>
  
  <p>EDIT: Ah, thanks for your help. I found the problem, it was that I was using an sqlite 2 database when I needed an sqlite 3 database.</p>