note 84871 deleted from function.mysql-insert-id by danbrown

From: Date: Sun, 03 Aug 2008 02:24:40 +0000
Subject: note 84871 deleted from function.mysql-insert-id by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-143069@lists.php.net to get a copy of this message
Note Submitter: steve at alittlefinesse dot com dot au ---- >> dane514 You wrote.... <?php function get_current_insert_id($table) { $q = "SELECT LAST_INSERT_ID() FROM $table"; return mysql_num_rows(mysql_query($q)) + 1; } ?> Try testing this with 4 records. Delete record #3, run your function and you will get ID of 4, NOT 5...

« previous php.notes (#143069) next »