db_insertId

Returns the auto generated id used in the last query

Returns
int

The value of the AUTO_INCREMENT field that was updated by the previous query; 0 if there was no previous query on the connection or if the query did not update an AUTO_INCREMENT value.