I have a database, test.db, with a table called Events. I tried this:

<?php
try
{
  // open the database
  $database = new PDO('sqlite:test.db');
  $result = $db->query('SELECT * FROM Events');
  foreach($result as $row)
  {
    // both of these lines produce a blank page
    //echo $row['EventName'] . ' | ' . $row['Location'];
    echo $row;
  }
}
catch(Exception $e)
{
  die('Could not connect to database.');
}
?>

but the resulting page is blank. Can anyone see anything wrong with my syntax?

Thanks,

David

I think line 6 should use $database, not $db

Wow, so silly! I HATE it that an error doesn't get displayed somewhere that I can access it (I only have ftp access). It may also be that php is just one of those languages that doesn't care if you use variable names that aren't defined - which always seemed insane to me.

Thanks for the catch.

David