Reputation: 57
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
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
Reputation: 1064
You can achieve the same using PDO:
See the examples and comments for fetchAll()
Upvotes: 0