At 11:13 PM -0400 8/14/99, 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?
LAST_INSERT_ID() returns the most recently automatically-generated
AUTO_INCRMENT value for the session (i.e., for the connection that
you have open to the server). If you close the connection and then
open another one and call LAST_INSERT_ID(), you'll get back a 0.
>I want to insert a record and then tell the user what there id is. Is
>LAST_INSERT_ID() what I should be using?
Yes, as long as you do so in the same connection as the one on
which you generated the record.
--
Paul DuBois, paul@stripped