I have the following code:
$query =$db->prepare(\"INSERT INTO a_table (id, a_field) VALUES (\'\', (:a_field)\"); $query->bindParam(\":a_field\",
PDO will return you the last ID inserted by the current active database connection.