Koren
Posts: 83
|
Posted: 04/20/2007, 11:56 AM |
|
I have a table that will be updated all the time by MANY users.
Once data is inserted into the table I need to extract the last inserted key and store it in a variable. I have used the famous
$xxx = CCDLookUp("max(field_id)","tablel","", $DBConnection1);;
in other record forms, but this one will require something much more accurate.
My understanding is that the MYSQL command:
SELECT LAST_INSERT_ID();
might be the way to go. I was reading that in order to get the best results the LAST_INSERT_ID() query has to be run within the same DBconnection. So, this brings me to my question. Can I run
$pk = CCDLookUp("LAST_INSERT_ID()", "", "", $DBConnection1)
in the AFTER insert to get the accurate result.
OR would this produce 1 separate connections?
Thanks So Much!
|