PHP Tutorial: Connecting to a database

PHP has three ways to connect to MySQL databases. These are called database APIs. There is a procedural version (mysqli_*) using simple functions. There are two object-oriented versions (MySQLi, PHP Data Objects (PDO)) which use classes. They are similar and return the same results.
The procedural version is often a better choice for beginners who may not know object-oriented programming yet…