© David Powers 2019
David PowersPHP 7 Solutionshttps://doi.org/10.1007/978-1-4842-4338-1_13

13. Connecting to a Database with PHP and SQL

David Powers1 
(1)
London, UK
 

PHP 7 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 PHP 7. 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, the order of arguments is usually different, so converting ...

Get PHP 7 Solutions: Dynamic Web Design 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.