note 83851 added to function.mysql-insert-id

From: Date: Sun, 15 Jun 2008 13:21:30 +0000
Subject: note 83851 added to function.mysql-insert-id
Groups: php.notes 
Request: Send a blank email to php-notes+get-140472@lists.php.net to get a copy of this message
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. ---- Server IP: 64.71.164.2 Probable Submitter: 84.255.242.236 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-insert-id.php Edit -- https://master.php.net/note/edit/83851 Del: integrated -- https://master.php.net/note/delete/83851/integrated Del: useless -- https://master.php.net/note/delete/83851/useless Del: bad code -- https://master.php.net/note/delete/83851/bad+code Del: spam -- https://master.php.net/note/delete/83851/spam Del: non-english -- https://master.php.net/note/delete/83851/non-english Del: in docs -- https://master.php.net/note/delete/83851/in+docs Del: other reasons-- https://master.php.net/note/delete/83851 Reject -- https://master.php.net/note/reject/83851 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#140472) next »