简体   繁体   English

如何在不插入任何数据的情况下获取php中的最后一个插入ID?

[英]How to Get last Insert Id in php without insert any data?

我需要在PHP中last inserted record而不插入任何数据, id before insert任何数据id before insert需要id before insert

I hope this is what you're looking for 我希望这是你要找的

SELECT id FROM table ORDER BY id DESC LIMIT 1

Hope this helps you out 希望这可以帮助你

Simply use 只需使用

SELECT MAX(id) FROM your_table_name

Or using PDO 或使用PDO

PDO::lastInsertId

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM