last insert id mysql php pdp code example Example: php pdo last insert id $stmt = $db->prepare("..."); $stmt->execute(); $id = $db->lastInsertId();