diff options
| author | Mark Newnham <mark@newnhams.com> | 2015-12-08 18:04:55 -0700 |
|---|---|---|
| committer | Mark Newnham <mark@newnhams.com> | 2015-12-08 18:04:55 -0700 |
| commit | bfd0e0a744e63a3021a3402b9c26800793147608 (patch) | |
| tree | d33f3bab5074b86563955d0448c9b8767371c5cf /drivers | |
| parent | 19d9ce59ce826d2c14db902f625a009eaac2bc23 (diff) | |
| download | adodb-bfd0e0a744e63a3021a3402b9c26800793147608.tar.gz adodb-bfd0e0a744e63a3021a3402b9c26800793147608.tar.bz2 adodb-bfd0e0a744e63a3021a3402b9c26800793147608.zip | |
insert_id did not return correct value after executing stored procedure
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/adodb-mysqli.inc.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index 3fad8be7..db952bb3 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -253,6 +253,13 @@ class ADODB_mysqli extends ADOConnection { function _insertid() { + /* + * mysqli_insert_id does not return the last_insert_id + * if called after execution of a stored procedure + * so we execute this instead. + */ + return ADOConnection::GetOne('SELECT LAST_INSERT_ID()'); + $result = @mysqli_insert_id($this->_connectionID); if ($result == -1) { if ($this->debug) ADOConnection::outp("mysqli_insert_id() failed : " . $this->ErrorMsg()); |
