Last ID Method

Last ID method is part of database class builder that returned postive integer value if an ID has generated automatically from auto increment feature.


Last ID method has no parameter.

$this->db->lastId(): integer

Example usage

Here is the examples using Last ID method. See the first of this page for full example.

Basic Usage

For example we assumed want to add new data in blog table. First, in the model:

class Blog_Model extends SENE_Model{
  var $tbl = 'blog';
  var $tbl_as = 'b';
  public function __construct(){
  public function insert($di){
    return $this->db->lastId();