PHP 8.5.0 Alpha 2 available for testing

SQLite3::lastInsertRowID

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

SQLite3::lastInsertRowIDDevuelve el identificador de la fila correspondiente a la última consulta de tipo INSERT

Descripción

public SQLite3::lastInsertRowID(): int

Devuelve el identificador de la fila correspondiente a la última consulta de tipo INSERT ejecutada en la base de datos.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

Devuelve el identificador de la fila correspondiente a la última consulta de tipo INSERT ejecutada en la base de datos. Si ninguna consulta de tipo INSERT en las tablas rowid ha tenido éxito en esta conexión de base de datos, entonces SQLite3::lastInsertRowID() devuelve 0.

add a note

User Contributed Notes 1 note

up
24
alexofen at KEINSpamgmail dot com
10 years ago
lastInsertRowID is relative to the database connection. Hence if there are two instances of a php script (with distinct $db connections) there is no risk that the RowID of the one instance will effect the result of the other instance.

I mention this point here as it was not clear from the documentation, at least not very clear to me and hence I hope it might help others.
To Top