Skip to main content

PHP PDO OOP CRUD Class with Bootstrap

In this Article we are going to learn about PHP PDO class, which can perform Create, Read, Update and Delete (CRUD). If you don’t know about PDO please refer to the PDO reference link before heading to this article.

Download

File Structure

Our File Structure will be as following:

File structure

Database Schema

Create Database named pdocrud and import the following table. Use following mysql query which will create a User table with 4 fields. id, firstname , lastname, and email.

Configuration

In the file structure you can see the config.php, which is our configuration file. This file is responsible for our database connection, and we also include our CRUD class here like include_once 'class.php-crud.php'; use the following code for the config.php file.