note 83515 added to function.mysql-insert-id

From: Date: Thu, 29 May 2008 13:12:28 +0000
Subject: note 83515 added to function.mysql-insert-id
Groups: php.notes 
Request: Send a blank email to php-notes+get-139981@lists.php.net to get a copy of this message
You cannot use a query to get "the next autoincrement value" (read: it is fundamentally impossible) because it will break if you have multiple processes updating your db. Trivally proven by the following scenario: * Query to get 'next autoincrement value' * Another process drops a new row in the DB and autoincrements *again* * Conflict ---- Server IP: 213.249.64.162 Probable Submitter: 195.64.88.137 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-insert-id.php Edit -- https://master.php.net/note/edit/83515 Del: integrated -- https://master.php.net/note/delete/83515/integrated Del: useless -- https://master.php.net/note/delete/83515/useless Del: bad code -- https://master.php.net/note/delete/83515/bad+code Del: spam -- https://master.php.net/note/delete/83515/spam Del: non-english -- https://master.php.net/note/delete/83515/non-english Del: in docs -- https://master.php.net/note/delete/83515/in+docs Del: other reasons-- https://master.php.net/note/delete/83515 Reject -- https://master.php.net/note/reject/83515 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139981) next »