0

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

Edited by daviddoria: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by daviddoria
0

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

Edited by daviddoria: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.