On Sat, 1999-08-14 23:13:47 -0400,
Jennifer <toxalot@stripped> wrote:
> I understand that LAST_INSERT_ID() returns the value of the last
> auto_increment value, but is that for the whole db or is separate
> for each table?
None of both. :)
Quoting chapter "7.3.12 Miscellaneous functions" of the MySQL manual:
| The last ID that was generated is maintained in the server on a
| per-connection basis. It will not be changed by another client.
So actually it's neither db nor table bound, but is to be understood
quite literal as the id, which has been automatically generated for
an AUTO_INCREMENT column last of all on the connection.
> I want to insert a record and then tell the user what there id is.
> Is LAST_INSERT_ID() what I should be using?
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26 E4 EC 80 58 7B 31 3A D7