Xyro
Xyro

Reputation: 227

Issue with opening sqlite database file

I am trying to make use of sqlite for the first time, now I have used this :

$this->linkIdentifier = new SQLiteDatabase($database);


and it created a database just fine as website.sqlite opening it again doesn't give any problem but as soon as I use http://code.google.com/p/phpliteadmin/ to create a table and I try to open it again it gives me this error : file is encrypted or is not a database

What could be causing this ?

Upvotes: 0

Views: 1699

Answers (2)

Christopher K.
Christopher K.

Reputation: 1195

Just for clarification: There are SQLite database-files of version 2 and version 3. With "new SQLiteDatabase()", you create a db-file of version 2. With "new SQLite3()" you create a file of version 3. PhpLiteAdmin has support for both versions if the appropriate php extension is installed. PhpLiteAdmin tells you the extension being used when you open the "structure" tab of the database under "SQLite extension". It should say "SQLiteDatabase" there if you open a version 2 database. If it does not, e.g. because this extension is not installed, you might not be able to edit a version 2 database in phpLiteAdmin. The SQLiteDatabase extension might not be included in recent versions of PHP, e.g. in PHP 5.4, it is only available via PECL.

Upvotes: 1

cweiske
cweiske

Reputation: 31078

I suggest to use PHP's own SQLite3 functions to create and save a database. Make sure to set the SQLITE3_OPEN_CREATE flag.

Upvotes: 0

Related Questions