note 31521 deleted from function.mysql-insert-id by cmb

From: Date: Sun, 16 Feb 2020 13:23:54 +0000
Subject: note 31521 deleted from function.mysql-insert-id by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-214107@lists.php.net to get a copy of this message
Note Submitter: treylane at example dot com ---- This might be obvious, but it tripped me up - be careful when using last_insert_id() with persistent connections - running last_insert_id() after a failed update/insert/etc will return the last insert id of the last successful update/insert made by that CONNECTION rather than 0 for the number of rows updated by the previous non-working query, and who knows what the last query run on that connection was.

« previous php.notes (#214107) next »