© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
D. PowersPHP 8 Solutionshttps://doi.org/10.1007/978-1-4842-7141-4_13

13. Connecting to a Database with PHP and SQL

David Powers1  
(1)
London, UK
 

PHP 8 offers two ways to connect to and interact with a MySQL database: MySQL Improved (MySQLi) and 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 database connection. It’s also important not to confuse MySQLi with the original MySQL extension, which is no longer supported. In most cases, the only difference in the names of MySQLi functions is the addition of the letter i (e.g., mysqli_query() instead of mysql_query()). However, ...

Get PHP 8 Solutions: Dynamic Web Design and Development Made Easy now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.