JustinK101 Posted November 9, 2006 Share Posted November 9, 2006 I see: mysql_insert_id -- Get the ID generated from the previous INSERT operationBut that requires that you have already done an insert operation. I need to just reference the next autoincrement value of the table. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/26643-how-to-get-the-next-auto-increment-value-in-mysql/ Share on other sites More sharing options...
doni49 Posted November 9, 2006 Share Posted November 9, 2006 Justin,Maybe if you tell us a little about what it is you're trying to accomplish, someone can help figure a way around that. Link to comment https://forums.phpfreaks.com/topic/26643-how-to-get-the-next-auto-increment-value-in-mysql/#findComment-121884 Share on other sites More sharing options...
JustinK101 Posted November 9, 2006 Author Share Posted November 9, 2006 Ok so here is what I have:$sql = "SELECT MAX(ID) AS max_id FROM employees";$result = mysql_query($sql) or die(fatal_error_alert(mysql_error(), $sql));$row = mysql_fetch_assoc($result);Which works, ($row['max_id'] + 1) holds the next autoincrement.Now, I need to way to manually increment the table employees without doing an insert. I just need to increment the auto-index. Link to comment https://forums.phpfreaks.com/topic/26643-how-to-get-the-next-auto-increment-value-in-mysql/#findComment-121887 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.