- Messages
- 1,165
- Reaction score
- 27
- Points
- 48
If you ever wondered how to get the next auto increment value form MySQL table then this small tutorial is for you:
You can find more info about "SHOW TABLE STATUS" MySQL command at:
http://jayapal.instablogs.com/entry/mysql-show-table-status-syntax/
PHP:
// You have to connect to MySQL and select a database before you can do this
$table_name = "myTable";
$query = mysql_query("SHOW TABLE STATUS WHERE name='$table_name'");
$row = mysql_fetch_array($query);
$next_inc_value = $row["AUTO_INCREMENT"];
You can find more info about "SHOW TABLE STATUS" MySQL command at:
http://jayapal.instablogs.com/entry/mysql-show-table-status-syntax/
Last edited: