Connecting to a Database with PHP and SQL
PHP offers three different ways to connect to and interact with a MySQL database: the original MySQL extension, MySQL Improved (MySQLi), or PHP Data Objects (PDO). Which one you choose is an important decision, because they use incompatible code. You can’t mix them in the same script. The original MySQL extension was deprecated in PHP 5.5 and will be removed at some unspecified date in the future. It’s not covered in this book.
If you plan to use only MySQL (or its drop-in replacement, MariaDB), I recommend that you use MySQLi. It’s designed specifically to work with MySQL and is fully compatible ...