Is there a way to get the value of a MySQL table, right after the form has been submitted? In fact, with each new form submitted, there is a unique code posted in the table, but I need that code to rederict the user to a specefic URL, that contain the unique code.
Asked
Active
Viewed 121 times
1
-
Possible repost of http://stackoverflow.com/questions/9477502/get-the-last-inserted-row-id-with-sql-statement – harmonickey Aug 04 '13 at 00:02
1 Answers
1
You can get the last MySQL-generated ID on the last inserted record by using last_insert_id()
. More information here.
INSERT INTO SomeTable (SomeColumn) VALUES ('SomeValue');
SELECT LAST_INSERT_ID();
Depending on which data access method you're using there may even be a PHP-visible function to do this for you.

David
- 208,112
- 36
- 198
- 279