From ea40a2ac0645354a8e2bb1bb48c5a7bfc1c2b2d5 Mon Sep 17 00:00:00 2001 From: mdean Date: Wed, 8 Aug 2001 00:45:47 +0000 Subject: [PATCH] Added get_last_insert_id() to return the last auto increment ID from an insert query. --- phpgwapi/inc/class.db_mysql.inc.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/phpgwapi/inc/class.db_mysql.inc.php b/phpgwapi/inc/class.db_mysql.inc.php index 17d32c30ab..c9e89c9079 100644 --- a/phpgwapi/inc/class.db_mysql.inc.php +++ b/phpgwapi/inc/class.db_mysql.inc.php @@ -289,6 +289,15 @@ return True; } + function get_last_insert_id() + { + /* This will get the last insert ID created on the current connection. Should only be called + * after an insert query is run on a table that has an auto incrementing field. + */ + + return @mysql_insert_id($this->Link_ID); + } + /* public: table locking */ function lock($table, $mode='write') {