sgillet
sgillet

Reputation: 3

php5-sqlite shows me nothing

The following code should display a message but shows me nothing (neither on the screen, nor in the source code). Any idea why this may be?

<?php
   try
   {   
      //create or open the database
      $database = new SQLiteDatabase('myDatabase.sqlite', 0666, $error);
      echo 'that works';
   }   
   catch(Exception $e) 
   {   
      die('that doesnt: '.$error);
   }

I'm using:

phpinfo() shows me the following:

SQLite was installed that way:

sudo apt-get install php5-sqlite

Upvotes: 0

Views: 277

Answers (1)

netcoder
netcoder

Reputation: 67695

SQLiteDatabase is not a valid class name, at least not in this extension.

You're looking for Sqlite3:

$db = new Sqlite3('myDatabase.sqlite');

Since the class is undefined, it's provoking a fatal error, and you probably don't see anything because of either your error_reporting level or display_errors setting.

Upvotes: 1

Related Questions