Simple Crud using PHP PDO Mysql

We are going to discuss PHP PDO CRUD Using MySQL Tutorial. At the end of this article, we will be able to make a CRUD module in PDO .

  1. PDO = PHP Data Objects. This is a PHP extension that defines a consistent and lightweight interface for accessing databases.
  2. CRUD = Create/Read/Update/Delete. It means, any basic application that has ability to for creating, deleting, updating and reading the records from specific database, we will call it CRUD.

Contents for PHP PDO CRUD

  1. Creating a database having a table
  2. Establishing the database connection
  3. Creating and Reading records
  4. Edit records
  5. Delete a record

1.Creating a database having a table

We will create a database with name crud_app in MySQL with the following table. This is a dummy data but you can use your data after the tutorial for your personal use.

2.Establishing the database connection


follow this code for php pdo mysql connection

3.Creating and displaying Records

Now, we will create a page index.php for adding the new records. Here is the the code



contains mysql insert query.

4.Edit Records:

contains selected record based on id.




5.Delete a record:

delete.php contains delete query with db validations.


Updated: September 10, 2017 — 8:19 pm Codelab- programming blog © 2017