PHP offers two extensions that allow you to work with SQLite effectively:
PDO_SQLITE
– is a driver that allows you to access multiple databases including SQLite, via a uniform interface (PDO).sqlite3
– is a driver that offers a more direct interface to SQLite, allowing you to access SQLite databases using its specific methods.
In this tutorial series, we’ll show you how to interact with SQLite using the PDO_SQLITE
driver.
Section 1. Getting Started
In this section, you’ll learn how to create a new SQLite database from PHP, connect to an existing SQLite database file, and create new tables in SQLite.
- Connecting to SQLite database – Show you how to create a new SQLite database and connect to an existing SQLite database in PHP using PDO.
- Creating SQLite tables using PDO – Guide you on creating new tables in the SQLite database by executing CREATE TABLE statements from PHP.
Section 2. Performing CRUD operations
CRUD stands for create, read, update, and delete. This section shows you how to insert, update, query, and delete data from a table in PHP.
- Inserting data into a table – Show how to insert data into a table in PHP.
- Updating data – Walk you through the steps of updating data in a table in PHP.
- Querying data – Show you various ways to query data from tables in PHP.
- Deleting data – Provides steps for deleting data from a table in PHP.
Section 3. Handling BLOB data
This section shows you how to store documents in SQLite databases as BLOB and how to retrieve them for display on web browsers.
- Working with SQLite3 BLOB data – Show you how to store documents (PDF files, Images…) directly in the SQLite database.
Section 4. Managing Transactions
This section lets you manage multiple database operations as a transaction to ensure data integrity.
- Managing Transactions – Learn how to manage multiple database operations as a transaction in PHP.