title: php error: Fatal error: Call to a member function fetch() on a non-object
body: <p>I am getting an error when running my php code:
  Any ideas on where I am going wrong here?</p>
  
  <p>Error says:
  <strong>Fatal error: Call to a member function fetch() on a non-object in C:\xampp\htdocs\autocomplete\test.php on line 7</strong></p>
  
  <pre><code>&lt;?php
   $database = new SQLiteDatabase('mydatabase.db');
  
   $sql = "SELECT * FROM guests";
   $result = $database-&gt;queryExec($sql);
  
   while ($row = $result-&gt;fetch()){
  
      echo $row['fname']." ".$row['lname'];
      echo " say ".substr($row['comments'], 0, 50);
   }
  
  
  ?&gt;
  </code></pre>