note 83942 deleted from function.mysql-insert-id by cmb

From: Date: Sun, 16 Feb 2020 13:40:29 +0000
Subject: note 83942 deleted from function.mysql-insert-id by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-214125@lists.php.net to get a copy of this message
Note Submitter: icethenet at NOSPAM dot hotmail dot com ---- Other methods seem to have problems with missing records in auto increment sometimes you will have records 1 2 5 6 most functions would return the value of 5 for next auto increment when indeed it would be 7. This is the only way I found to make this work so I can use my customer number and the record number to provide a truly unique customer number that is also useful. $next_increment = 0; $qShowStatus = "SHOW TABLE STATUS LIKE 'your_table'"; $qShowStatusResult = mysql_query($qShowStatus) or die(mysql_error()); $row = mysql_fetch_assoc($qShowStatusResult); $next_increment = $row['Auto_increment']; echo $next_increment; then you can do something like this echo $next_increment ."-". rand(); My first post: I hope this is useful to someone

« previous php.notes (#214125) next »