Call the Prepare method to prepare the query
$stmt = $pdo->prepare ($sql);
Pass an array to the named parameter binding value in the preprocessing query, and execute the SQL
$stmt->execute (Array (': Name ' = ' Harry '));
Gets the ID value of the last inserted data
echo $pdo->lastinsertid (). '
';
This approach may have concurrency problems.
Reply content:
Call the Prepare method to prepare the query
$stmt = $pdo->prepare ($sql);
Pass an array to the named parameter binding value in the preprocessing query, and execute the SQL
$stmt->execute (Array (': Name ' = ' Harry '));
Gets the ID value of the last inserted data
echo $pdo->lastinsertid (). '
';
This approach may have concurrency problems.
Every link in MySQL is a session
The $pdo->lastInsertId()
last insertion ID of the current session is obtained
This $pdo is private and does not take the data that someone else has inserted.
The code is executed from the top down one line, even if you write a loop.