Get the unique id for the last inserted row mysql March 16, 2017 by anvar There is a function to know what was the last id inserted in the current connect Im MySQL SELECT LAST_INSERT_ID(); With PDO: $pdo->lastInsertId(); With Mysqli: $mysqli->insert_id;