Link to home
Start Free TrialLog 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
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.