db2_last_insert_id

PECL ibm_db2 >= 1.7.1
db2_last_insert_id - Returns the auto generated ID of the last insert query that successfully executed on this connection
Manual
Code Examples

db2_last_insert_id( resource$resource ): string

Returns the auto generated ID of the last insert query that successfully executed on this connection.

The result of this function is not affected by any of the following:

A single row INSERT statement with a VALUES clause for a table without an identity column.

A multiple row INSERT statement with a VALUES clause.

An INSERT statement with a fullselect.

A ROLLBACK TO SAVEPOINT statement.

Parameters

resource

A valid connection resource as returned from db2_connect or db2_pconnect. The value of this parameter cannot be a statement resource or result set resource.

Return Values

Returns the auto generated ID of last insert query that successfully executed on this connection.

Example of db2_last_insert_id

Show all examples for db2_last_insert_id

PHP Version: