i have tried lot to connect database using PHP PDO. i have got lot of samples, i am not sure what was problem.
below is my code
<?php
try
{
// $db = new PDO('sqlite:sampleDB.db3');
// $db = new SQLiteDatabase('sampleDB.sqlite', 0666, $error);
$db = new PDO('sqlite:sampleDB.sqlite');
}
catch(PDOException $e)
{
echo $e->getMessage();
}
?>
i have tried lot of way to open a connection. please tell me the correct way...
I gave up with PDO driver, and used sqlite3 module instead for same reasons.
With sqlite3 module:
class DB extends SQLite3
{
function __construct( $file )
{
$this->open( $file );
}
}
$db = new DB( 'sampleDB.sqlite' );
I know it's not a solution for your problem, but if nothing else works, this could be useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With