get id of last inserted row sql php code example Example: get last inserted id in php Example (MySQLi Procedural) $last_id = mysqli_insert_id($conn);