0 Replies - 1631 Views - Last Post: 21 September 2007 - 08:28 AM

#1 supersssweety   User is offline

  • D.I.C Regular
  • member icon

Reputation: 22
  • View blog
  • Posts: 373
  • Joined: 16-March 07

Select Last Insert

Posted 21 September 2007 - 08:28 AM

Description: So you have inserted a record but you need to use the data right after. You are using an auto-increment field so you have no idea what the PK is and you need it in a variable.

Select last insert get the last insert and puts it into a variable for you. It is super easy...Get the last insert to the Database
SELECT LAST_INSERT_ID() AS <insert variable name here> FROM <insert table name here>


Is This A Good Question/Topic? 0
  • +

Page 1 of 1