auto increment sql value: comment obtenir la valeur de l’auto increment id d’une table sql
voici comment récupérer la valeur de l’indice auto increment d’une table sql, sans passer par un last mysql insert id etc
<?php
$tablename = "matable";
$next_increment = 0;
$qShowStatus = "SHOW TABLE STATUS LIKE ‘$tablename’";
$qShowStatusResult = mysql_query($qShowStatus)
or die ( "Query failed: " . mysql_error() . "
" . $qShowStatus );
$row = mysql_fetch_assoc($qShowStatusResult);
$next_increment = $row['Auto_increment'];
echo "next increment number: $next_increment";
?>