note 83851 deleted from function.mysql-insert-id by googleguy

From: Date: Tue, 22 Oct 2013 11:01:18 +0000
Subject: note 83851 deleted from function.mysql-insert-id by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197023@lists.php.net to get a copy of this message
Note Submitter: erik.something@GMAIL DOT COM ---- I have come up with an unorthodox solution for this problem. Im sure its not the fastest but its surely the safest. In sql I have made a column to be "unique" and instead of fetching the last Id generated by auto_increment I make a random number and I store that number in the before created column. Example: id ____ rand_nr ____ name 1 ____ 345432 ____ Richard 2 ____ 598675 ____ Joe 3 ____ 926374 ____ Patrick This way I know exactly what number coresponds to the row inserted.

« previous php.notes (#197023) next »