⇧
vadnica-logo
My Services About the Project Telegram O meni O meni

Last Inserted ID (LAST INSERT ID)

When we insert a new record into a table using AUTO_INCREMENT, the database automatically generates a new unique ID. The lastInsertId() method allows us to retrieve this number immediately and use it further in our application.

EXAMPLE
RESULT
The result will be displayed here...

In the example above, we inserted 5 additional people into the users table (totaling 10). The method will return the number 10, confirming the ID of the last successfully inserted record.