The SQLite3 extension is enabled
by default as of PHP 5.3.0. It's possible to disable it by using --without-sqlite3
at compile time. Windows users must enable php_sqlite3.dll in order to use this
extension. This DLL is included with Windows distributions of PHP as of PHP
5.3.0. aFor detailed installation instructions, kindly check our PHP tutorial
and its official website.
Connection to Databases.
Following PHP code shows how to
connect to an existing database. If database does not exist, then it will be
created and finally a database object will be returned.
<?php
class MyDB extends SQLite3
{
function __construct()
{
$this‐>open('test.db');
}
}
$db = new MyDB();
if(!$db){
echo $db‐>lastErrorMsg();
} else {
echo "Opened database successfully\n";
}
?>
0 komentar