PHP has had three MySQL 524 APIs. The original mysql_* functions had no prepared statements; they were deprecated in PHP 5.5 and removed in PHP 7.0, so a tutorial that uses them describes code that no longer runs. mysqli (PHP 5.0) and PDO (PHP 5.1) replaced them. Both sit on the mysqlnd client library and perform the same, and modern mysqli is pleasant: exceptions by default since PHP 8.1, and $db->execute_query($sql, [40]) to prepare, bind and run in one call since 8.2.
| Feature | mysqli | PDO |
|---|---|---|
| Databases | MySQL and MariaDB 3,681 only | 11 documented drivers |
| Placeholders | ? only | ? and :name |
| Style | Procedural and object | Object only |
| Fetch into a class | fetch_object() | FETCH_CLASS, FETCH_GROUP, FETCH_KEY_PAIR... |
| MySQL-only extras | Async queries, multi_query() | Few (Subsection 4.16.14) |
PDO wins because the knowledge transfers: the same calls work on SQLite 4,756 in your tests and on PostgreSQL 1,289 in your next job, and Laravel 2,157 's database layer (Laravel) is built on it. Keep mysqli for what PDO lacks, such as asynchronous queries, and rewrite inherited code that interpolates variables into SQL with placeholders whichever API it uses.