Jump to content

How to retrieve a primary key


xxreenaxx1

Recommended Posts

I have a form that ask user to enter other details but the primary key as this is automated and when they click on Submit button it takes the user to different form. now on this form I would like to retreive the primary that has just been added to the table. How can I do this?

Link to comment
https://forums.phpfreaks.com/topic/228083-how-to-retrieve-a-primary-key/
Share on other sites

Assuming you are talking about MySQL and  "the ID generated for an AUTO_INCREMENT column by the previous query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established." (PHP manual) you can use the

mysql_insert_id()

function

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.