略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SQLite3::lastInsertRowID

2024-12-22

SQLite3::lastInsertRowID

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

SQLite3::lastInsertRowIDReturns the row ID of the most recent INSERT into the database

说明

public SQLite3::lastInsertRowID(): int

Returns the row ID of the most recent INSERT into the database.

参数

此函数没有参数。

返回值

Returns the row ID of the most recent INSERT into the database. If no successful INSERTs into rowid tables have ever occurred on this database connection, then SQLite3::lastInsertRowID() returns 0.

add a noteadd a note

User Contributed Notes 1 note

up
24
alexofen at KEINSpamgmail dot com
7 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.

官方地址:https://www.php.net/manual/en/sqlite3.lastinsertrowid.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3