Get Last Inserted ID in PDO

Get Last Inserted ID in PDO

PHP will work with virtually all database software, including Oracle and Sybase but most commonly used is freely available MySQL database.

What is PDO?
PDO refers to PHP Data Object, which is a PHP extension that defines a lightweight and consistent interface for accessing a database in PHP. It is a set of PHP extensions which provide a core PDO class and database-specific driver. Each database driver can expose database-specific features as a regular extension function that implements the PDO interface.

If we perform an INSERT or UPDATE on a table with an AUTO_INCREMENT field, we can get the ID of the last inserted/updated record immediately.
June 17, 2021
phpdatabasepdo
Crypto Advertising Network