I have the following code:
$query =$db->prepare(\"INSERT INTO a_table (id, a_field) VALUES (\'\', (:a_field)\"); $query->bindParam(\":a_field\",
No, this situation is impossible. Method $db->lastInsertId() returns last inserted id for this DB conection. In other page will be another connection and another last inserted id.