Fixing PHP SQLite database is locked warning - Unable to execute statement: database is locked

Apparently this error is caused by not closing the database after using it. 

Warning: SQLite3::query(): Unable to execute statement: database is locked.

You can close the database using the following code:

PHP

$db->close();
unset($db);

// you can also set a busy timeout for sqlite
$db->busyTimeout(3000);

Other Items in php
Page Views

This page has been viewed 142 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹

Random Quote
Interesting...

Me