Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: SELECT LAST_INSERT_ID does not work

by Marshall (Canon)
on Jun 28, 2017 at 06:06 UTC ( [id://1193757]=note: print w/replies, xml ) Need Help??

in reply to SELECT LAST_INSERT_ID does not work

I am unsure what the problem is. MySql doc says:

For LAST_INSERT_ID(), the most recently generated ID is maintained in the server on a per-connection basis. It is not changed by another client. It is not even changed if you update another AUTO_INCREMENT column with a nonmagic value (that is, a value that is not NULL and not 0). Using LAST_INSERT_ID() and AUTO_INCREMENT columns simultaneously from multiple clients is perfectly valid. Each client will receive the last inserted ID for the last statement that client executed.
Out of curiosity, why do you even care what the last auto_increment unique number that your client used was? Why does it matter to you? Other clients could be many, many numbers ahead of you. You can know this number for your last insert, then I guess you use that as a field for an entry into a different table? But why would you want to do that?
  • Comment on Re: SELECT LAST_INSERT_ID does not work

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1193757]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-05-27 15:56 GMT
Find Nodes?
    Voting Booth?

    No recent polls found