Schlagwort-Archiv: mysql

Nächste auto_increment ID einer MySQL Tabelle

Wenn man wissen will was die nächste auto_increment ID einer MySQL-Tabelle werden wird, hilft SHOW TABLE STATUS weiter:

$qShowStatus = "SHOW TABLE STATUS LIKE 'tabellenname'";
$qShowStatusResult = mysql_query($qShowStatus);
$row = mysql_fetch_assoc($qShowStatusResult);
var_dump($row);

Ergebnis:

array(18) {
[...]
["Index_length"]=> string(5) "33792"
["Data_free"]=> string(1) "0"
["Auto_increment"]=> string(4) "3847"
["Create_time"]=> string(19) "2009-06-25 11:54:04"
[...]
}