If you are using ADDT, you can get the last primary key inserted by using this function in a custom trigger, in your case, after insert:
$my_last_key = getPrimaryKeyValue();
- returns the value of the primary key of the record modified by the transaction
Otherwise, if you are using MySql, then use the MySql function:
thanks for reply
ok this function getPrimaryKeyValue(); will return the last id i have inserted or the last id inserted even by other one?
I am not certain, but I believe it returns the last row inserted in that table by that session, working the same way as the MySql last_insert_id(). So it should send you back the primary key that that current user inserted (not the last key inserted overall).
You may want to test this: open two sessions of your application, insert rows in the first session, then the second, then retrieve the key under the first session.