Skip to content

Commit

Permalink
Fix for insertid not returning what it's supposed to
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Davenport committed Mar 26, 2016
1 parent d8a127f commit e5a9742
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libraries/joomla/database/driver/pdomysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,20 @@ public function dropTable($tableName, $ifExists = true)
return $this;
}

/**
* Method to get the auto-incremented value from the last INSERT statement.
*
* @return string The value of the auto-increment field from the last inserted row.
*
* @since 12.1
*/
public function insertid()
{
$this->connect();

return $this->setQuery('SELECT LAST_INSERT_ID() AS id')->execute()->fetchObject()->id;
}

/**
* Select a database for use.
*
Expand Down

0 comments on commit e5a9742

Please sign in to comment.