SQLite3::lastInsertRowID

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

SQLite3::lastInsertRowIDВозвращает идентификатор строки последней вставки (INSERT) в базу данных

Описание

public SQLite3::lastInsertRowID(): int

Возвращает идентификатор строки последней вставки (INSERT) в базу данных.

Список параметров

У этой функции нет параметров.

Возвращаемые значения

Возвращает идентификатор строки последней вставки (INSERT) в базу данных. Если при этом соединении с базой данных никогда не происходило успешных операций INSERT в таблицы rowid, то SQLite3::lastInsertRowID() возвращает 0.

Добавить

Примечания пользователей 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