Re: mysql_insert_id?

From: Date: Wed, 16 Jan 2002 15:20:27 +0000
Subject: Re: mysql_insert_id?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-80720@lists.php.net to get a copy of this message
Hi Martin, >> 2 because the (function argument) controlling feature is the >> connection, it is not possible for another concurrent user to >> 'steal' your ID or influence the ID returned to you - it's all > Ok, assume you are correct, but what if you are using persistent > connections (ie pconnet)? don't worry, persistent connection is per-child-process basis, so concurrent users will use different connection to DB. the only problem i can think of might occur with pconnect is, last_insert_id() will return you the last inserted ID from previous 'session', not current 'session'. to prevent this, you should call last_insert_id() only when your INSERT query executed succesfully. -- Jimmy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Right thinking leads to right living

« previous php.general (#80720) next »