Link to home
Create AccountLog in
Avatar of debbieau1
debbieau1Flag for United States of America

asked on

last record ID

I am inserting record then getting the id using mysql_insert_id() from an auto increment field.

Will it always pull up the last id, entered by that user, or if another user add something,  is there a risk it could pull up the id for their record?

Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

It will always be for the user session, irrespective of what other users do.  It is stored specific to the user session, in other words.
ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of debbieau1

ASKER

Thanks, that's a great help

Can I confirm that in my case last_insert_id() would be better to use.  I am not clear on the difference.

Also I did read somewhere that using mysql_insert_id() is a time bomb for very large tables.