Returns the last inserted autoincremented field value in the current connection.
Syntax
DB::LastId()
Arguments
No arguments.
Return value
Returns the last inserted autoincremented field value in the current connection.
Example
You can print the ID of the previously inserted record. This code works in any server side event like AfterAdd, AfterEdit, or BeforeProcess.
$data = array();
$data["make"] = "Toyota";
$data["model"] = "RAV4";
$data["price"] = 16000;
DB::Insert("cars", $data );
// get the ID of the inserted record and print it on the page
echo DB::LastId();
See also:
•Database API: SetConnection()