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

From: Date: Sun, 16 Feb 2020 13:31:28 +0000
Subject: note 70805 deleted from function.mysql-insert-id by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-214118@lists.php.net to get a copy of this message
Note Submitter: buana95 att yahoo dott com ---- It's not true that mysql_insert_id() only returns the ID generated for an AUTO_INCREMENT column by the previous INSERT query. We can use LAST_INSERT_ID() statement that will return value for mysql_insert_id(). Example: $sql = "UPDATE mytable SET mytable_id= LAST_INSERT_ID(mytable_id + 1) WHERE ...; @mysql_query($sql); $last_id = mysql_insert_id(); LAST_INSERT_ID() statement will affect mysql_insert_id(). Regards, Buana

« previous php.notes (#214118) next »