DbSQL::insertId

Usage

?int Db::insertId()

Description

Get value of the last auto incremented column generated during an insert.

Return Value

?The id# of the last auto incremented column during an insert. Will return null if no previous inserts were performed.

Examples

Get Last Insert ID#


// Insert row $this->db->insert('some_type', [ 'name' => 'John Smith', 'email' => 'john@domain.com' ]); $id = $this->db->insertId(); echo "Latest id# is $id\n";

See Also