Skip to content

Instantly share code, notes, and snippets.

@lidio601
Last active August 29, 2015 14:02
Show Gist options
  • Save lidio601/1c2092c6a956d9074ed0 to your computer and use it in GitHub Desktop.
Save lidio601/1c2092c6a956d9074ed0 to your computer and use it in GitHub Desktop.
SQLLite PHP test
<?php
# see https://bitbucket.org/lidio601/framework-fabio
# PHP Framework derived from Joomla CMS Libraries
require_once("framework_fabio.php");
$options = array(
'driver' => 'sqllite',
'file' => './dbfile.xmf'
);
$db = _getDBO($options);
if ($db) {
if( !$db->tableExists('foo') ) {
$db->setQuery('CREATE TABLE foo (bar varchar(10))');
$db->query();
}
$db->setQuery("INSERT INTO foo VALUES ('fnord')");
$db->query();
$db->setQuery('select bar from foo');
$result = $db->loadObjectList();
print_r($result);;
} else {
print_r($db);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment