Forum Moderators: coopster
function get_auto_increment($table_name,$link_identifier=false)
{
if ($link_identifier) $dh=mysql_query("SHOW TABLE STATUS",$link_identifier);
else $dh=mysql_query("SHOW TABLE STATUS");
while ($row=mysql_fetch_assoc($dh))
{ if ($row[Name]==$table_name)
{
return $row[Auto_increment];
break;
} [red]
}[/red]
return false;
} Useful in conjunction with
ALTER TABLE $table_name AUTO_INCREMENT $newvalue Usage:
Find out the next auto_increment value for `test` table:
print "Next test ID will be: ".get_auto_increment("test")