# Retrieving the ID of the Last Insert
+ **`mysqli`**
  + Use **`mysql_insert_id()`** statement
+ **`PDO_MySQL`**
  + Use the database handle's **`lastInsertId()`** method
```
...
echo "Last Insert ID retrieved by mysqli: " . ~!@mysqli_insert_id($mysqli)@!~ . "<p>";
echo "Last Insert ID retrieved by PDO_MySQL: " . ~!@$dbHandle->lastInsertId()@!~ . "<p>";
...

Last Insert ID retrieved by mysqli: ~!@3170534137668829185@!~

Last Insert ID retrieved by PDO_MySQL: ~!@864691128455135238@!~
```
----------------------------------------------------------
To retrieve the most recent `AUTO_INCREMENT` and `AUTO_RANDOM` value:
- For `mysqli`, use the `mysqli_insert_id()` function. 
- For `PDO_MySQL`, use the `PDO` database connection object's `lastInsertId()` method.
