jrg70 Posted July 27, 2006 Posted July 27, 2006 Hello all. I would like to know if there is a way to get the auto increment number from a row that is just created. Here's the senario: I'm using PHP to display a page and have the user input some information. Then I have the PHP code 'INSERT' that data into a new row that is created dynamically. Each row that is created is given a unique id number by auto increment. The number is placed into the field 'id'. What I want to get is after the information is inputted into the database, have the newly created "id number" returned so I can have the page show the inputted data. Do you understand my question, or did I ramble? Anyway, if you do understand and can help, I sure would appreciate it. Thank you. Quote
TweezerMan Posted July 27, 2006 Posted July 27, 2006 You can get the last AUTO_INCREMENT generated by using the mysql_insert_id() function right after performing the INSERT query. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.