SQLite3::lastInsertRowID

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

SQLite3::lastInsertRowIDRetorna o ID da linha mais recentemente INSERIDA no banco de dados

Descrição

public SQLite3::lastInsertRowID(): int

Retorna o ID da linha mais recentemente INSERIDA no banco de dados.

Parâmetros

Esta função não possui parâmetros.

Valor Retornado

Retorna o ID da linha mais recentemente inserida no banco de dados. Se nenhuma inserção bem-sucedida em tabelas com rowid já ocorreu nesta conexão de banco de dados, então SQLite3::lastInsertRowID() retorna 0.

adicione uma nota

Notas Enviadas por Usuários (em inglês) 1 note

up
22
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