note 128329 added to mysqli.insert-id
| From: | jpage at chatterbox dot fyi | Date: | Wed, 22 Mar 2023 18:50:55 +0000 |
| Subject: | note 128329 added to mysqli.insert-id | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220287@lists.php.net to get a copy of this message | ||
What is unclear is how concurrency control affects this function. When you make two successive
calls to mysql where the result of the second depends on the first, another user may have done an
insert in the meantime.
The documentation is silent on this, so I always determine the value of an auto increment before and
after an insert to guard against this.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 73.252.213.251)
----
Manual Page -- https://php.net/manual/en/mysqli.insert-id.php
Edit -- https://main.php.net/note/edit/128329
Del: integrated -- https://main.php.net/note/delete/128329/integrated
Del: useless -- https://main.php.net/note/delete/128329/useless
Del: bad code -- https://main.php.net/note/delete/128329/bad+code
Del: spam -- https://main.php.net/note/delete/128329/spam
Del: non-english -- https://main.php.net/note/delete/128329/non-english
Del: in docs -- https://main.php.net/note/delete/128329/in+docs
Del: other reasons-- https://main.php.net/note/delete/128329
Reject -- https://main.php.net/note/reject/128329
Search -- https://main.php.net/manage/user-notes.php