If you ever wondered how to get the next auto increment value form MySQL table then this small tutorial is for you:
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 LIKE '$table_name'");
$row = mysql_fetch_array($query);
$next_inc_value = $row["AUTO_INCREMENT"];
No comments:
Post a Comment