Magento 2 Development Workshop Learn More

User Registration with PHP and MySQL

14 lessons

Connecting to a Database via PHP PDO class

In this lesson, we are going to learn how to connect to a MySQL database with the help of PHP PDO class.

Lesson Overview

In this lesson, we are going to learn:

  • What is DSN?
  • How to connect to a MySQL database via PHP PDO class?
  • How to process a failure database connection with the try/catch statement