note 46102 deleted from function.mysql-insert-id by betz

From: Date: Fri, 01 Oct 2004 07:32:13 +0000
Subject: note 46102 deleted from function.mysql-insert-id by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77659@lists.php.net to get a copy of this message
Note Submitter: crusaderky at libero dot it ---- Never, EVER forget that Apache 2 is multithreaded. So, writing mysql_query($query); $id = mysql_insert_id(); Will eventually cause a disaster (data corruption and the like, depending on your code) as soon as two threads do a query at the same time. Additionally, these sort of bugs are almost impossible to track down. The correct code is: $resource = mysql_query($query); $id = mysql_insert_id($resource);

« previous php.notes (#77659) next »