brittny85 Posted June 29, 2006 Share Posted June 29, 2006 I am working on a project in which I use multiple forms to get data in a MySQL table. I want to get the id out of a data row as I am inputting other data into it. Using multiple html forms I will insert the other data but the id is auto-incremented and used as a primary key. However on the following pages I will need that id so that all of the data is input in the same row. Is there a way I can get that id so that I can use it later? Quote Link to comment Share on other sites More sharing options...
jworisek Posted June 30, 2006 Share Posted June 30, 2006 well you can use this code immediately after submitting the data...[code]"SELECT last_insert_id() as id_number from table_name";[/code]and then save that ID in either a hidden form field or a session variable. Quote Link to comment Share on other sites More sharing options...
brittny85 Posted June 30, 2006 Author Share Posted June 30, 2006 Perfect! That's exactly what I was looking for!! Thank you soo much. I knew it would be something that was probably that simple, I just didn't know where to find it. Thanks again!!-Brittny ;D Quote Link to comment Share on other sites More sharing options...
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.