PHP SQLite support

pdo_sqlite support PHP Portable Data Object ( PDO ) has a driver for SQLite database as pdo_sqlite. We can check the support for the driver by using phpinfo().
Use phpinfo() to get PHP installation details, code is here
echo phpinfo();


Part of the output is shown here with PDO SQLite support.

Checking PDO driver support using if - else

To check for different database PDO driver support we can use this code.
By using PDO::getAvailableDrivers() we can get an array of available PDO drivers, so we can use if-else to display appropriate message to user .
if (!in_array("sqlite",PDO::getAvailableDrivers(),TRUE))
 throw new PDOException ("Cannot work without a proper database setting up");
 echo "<font color='green'>Database setup is OK</font>";

If SQLite dirver support is missing then follow the instructions at php.ini here to enable the support. ( restart if php.ini is changed )

sqlite3 support

Check phpinfo() to know about sqlite3 library support.
sqlite3 library support
Update or enable sqlite3 library support in your php.ini file.

Enable php_sqlite3.dll inside your php.ini file.

sqlite3 enable at php.ini file

Version details of sqlite3 library
$ver_dtl = SQLite3::version();

echo $ver_dtl['versionString'] . "<br>";
echo $ver_dtl['versionNumber'] . "<br>";

Output is here ( may change based on your installation )
array(2) { ["versionString"]=> string(8) "" ["versionNumber"]=> int(3008010) }
Download sample script for SQLite with instructions on how to use.

Connection to SQLite and create table

PHP SQLite PDO Functions
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer