note 71215 added to function.mysql-insert-id

From: Date: Thu, 16 Nov 2006 18:41:11 +0000
Subject: note 71215 added to function.mysql-insert-id
Groups: php.notes 
Request: Send a blank email to php-notes+get-119814@lists.php.net to get a copy of this message
There is a problem with the function below submitted by rudolflai In that mysql_autoid function, what happens when between the time you've retrieved the id and the time you do something with it (like INSERT a new record) another new record has been inserted into the database in the interim? Better make sure you LOCK the tables you're working on before you use the function and don't UNLOCK until after you've done something with the id returned. ---- Server IP: 216.194.113.175 Probable Submitter: 70.112.195.98 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-insert-id.php Edit -- https://master.php.net/note/edit/71215 Del: integrated -- https://master.php.net/note/delete/71215/integrated Del: useless -- https://master.php.net/note/delete/71215/useless Del: bad code -- https://master.php.net/note/delete/71215/bad+code Del: spam -- https://master.php.net/note/delete/71215/spam Del: non-english -- https://master.php.net/note/delete/71215/non-english Del: in docs -- https://master.php.net/note/delete/71215/in+docs Del: other reasons-- https://master.php.net/note/delete/71215 Reject -- https://master.php.net/note/reject/71215 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119814) next »