PDO - PHP Database Extension

Learn about the PDO extension, connecting with MySQL database, and creating a table through PDO.

PDO (PHP Data Objects) is a PHP extension through which we can access and work with databases. Though PDO is similar in many aspects to MySQLi, it is better to work with because of the following reasons:

  • It is consistent across databases, so it can work with MySQL as well as other types of databases (SQLite, Oracle, PostgreSQL, and others).
  • It is object-oriented at its core.
  • It is better protected against hackers.

We’ll find recipes for the four basic functions that we perform with the database:

  • Insertion
  • Selection
  • Update
  • Deletion

The recipes are intended to work with MySQL, but PDO can easily be used with other types of databases.

Get hands-on with 1200+ tech skills courses.