teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

参考URL追記

2020/03/17 05:33

投稿

yodel
yodel

スコア508

answer CHANGED
@@ -1,2 +1,4 @@
1
- lastInsertID()はトランザクション内で最後にInsertされたIDを取得するものなので、
1
+ `lastInsertId()`はトランザクション内で最後にInsertされたIDを取得するものなので、
2
- 既にコミット済みのテーブルから取得する場合は、select max(ID) from table; になると思います。
2
+ 既にコミット済みのテーブルから取得する場合は、select max(ID) from table; になます。
3
+
4
+ 参考:[https://www.php.net/manual/ja/pdo.lastinsertid.php](https://www.php.net/manual/ja/pdo.lastinsertid.php)