ramanse
ramanse

Reputation: 57

PHP class to easily use SQLite3 on PHP?

Does someone has or know a php class to easily use SQLite3 on PHP?

I has been using this one http://code.jenseng.com/db/ but it's for sqlite2 dbs.

I used it to execute queries and fetch arrays of results, I've found one but its a huge code, I was looking for something simpler.

Upvotes: 3

Views: 12369

Answers (3)

Gordon
Gordon

Reputation: 316969

PHP has a native SQLite3 class, which is enabled by default as of PHP 5.3.0

Example from PHP Manual

$db = new SQLite3('mysqlitedb.db');
$db->exec('CREATE TABLE foo (bar STRING)');
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
$result = $db->query('SELECT bar FROM foo');
var_dump($result->fetchArray());

Upvotes: 11

icanhasserver
icanhasserver

Reputation: 1064

You can achieve the same using PDO:

http://www.php.net/PDO

See the examples and comments for fetchAll()

Upvotes: 0

Mathias E.
Mathias E.

Reputation: 471

you should be able to do so with the PDO class (Cross DBMS).

Upvotes: 4

Related Questions