Created
October 23, 2013 21:55
-
-
Save BrendonKoz/7127489 to your computer and use it in GitHub Desktop.
A way to get the next insert ID if you are certain there won't be any conflicts (other insertions during processing) from MySQL. Source: http://stackoverflow.com/a/12500309/155421
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT AUTO_INCREMENT | |
FROM information_schema.tables | |
WHERE table_name = 'table_name' | |
AND table_schema = DATABASE( ) ; | |
--- or --- | |
$result = mysql_query("SHOW TABLE STATUS LIKE 'table_name'"); | |
$row = mysql_fetch_array($result); | |
$nextId = $row['Auto_increment']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment