07. PHP How to connect to a MySQL database(Mysqli, PDO) | PHP Tutorial | PHP | PHP course |

Опубликовано: 23 Июнь 2020
на канале: IT&IoT Tutorials
355
6

In order to store or access the data inside a MySQL database, you first need to connect to the MySQL database server
PHP 5 and later versions can work with a MySQL database using:
MySQLi extension (the "i" stands for improved)
PDO (PHP Data Objects)
Earlier versions of PHP used the MySQL extension, but this extension was deprecated in 2012.

While the PDO extension is more portable and supports more than twelve different databases, MySQLi extension as the name suggests supports MySQL database only. MySQLi extension however provides an easier way to connect to, and execute queries on, a MySQL database server. Both PDO and MySQLi offer an object-oriented API, but MySQLi also offers a procedural API which is relatively easy for beginners to understand.