问题
I've a database with hundreds of records which inserted in each seconds, I have the below insert query and I want to know the insert id of this query:
$currQuery = $pdo->prepare("INSERT INTO some_table (...... )");
$currQuery->execute("....");
$queryInsertId = $pdo->lastInsertId();
I just want to know that is it safe to use lastInsertId()
while I having hundreds of new records in every seconds? any ideas?
回答1:
Yes it is safe. It returns the last insert id for the connection.
来源:https://stackoverflow.com/questions/25649905/is-it-safe-to-get-id-through-lastinsertid