PDO - Get the Last Insert Id

With PDO you just do run the lastInsertId method.

<?php
$result = $db->exec("INSERT INTO table(firstname, lastname) VAULES('John', 'Doe')");
$insertId = $db->lastInsertId();