You have permission to edit this article.

PHP: SQLite3

WARNING: sqlite3 function is deprecated and will be removed in PHP5.5, switch to PDO sqlite

The SQLite3 module available to customers in /app/ is a custom installation.  The sample code below allows a user to open, insert, and select from a sqlite3 database. API documentation is available here:



$db = sqlite3_open('mysqlite3db.db');

sqlite3_exec($db, "CREATE TABLE foo (bar STRING)");

sqlite3_exec($db, "INSERT INTO foo (bar) VALUES ('This is a test')");

$res = sqlite3_query($db, "SELECT bar FROM foo");

$array = sqlite3_fetch_array($res);