Re: Re: Random Unique ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tijnema ! wrote:

> On 3/22/07, Roman Neuhauser <neuhauser@xxxxxxxxxx> wrote:
>> # turnermm02@xxxxxxx / 2007-03-21 21:03:35 -0500:
>> > Mark wrote:
>> > >ccspencer@xxxxxxxxxxxx wrote:
>> > >
>> > >>Hello,
>> > >>
>> > >>I want to add a random unique ID to a Mysql table.  Collisions
>> > >>are unlikely but possible so to handle those cases I'd like to
>> > >>regenerate the random ID until there is no collision and only
>> > >>then add my row.  Any suggestions for a newbie as to the right
>> > >>way to go about doing this?
>> > >>
>> > >>Best,
>> > >>
>> > >>Craig
>> > >.
>> > >
>> > >I suggest looking into a GUID sort of thing, it is all coded for you
>> > >and it works just like you want.
>> >
>> > If you are running Linux, you can get this using:
>> >    $GUID =  exec("uuidgen");
>>
>> http://www.ossp.org/pkg/lib/uuid
> 
> Note that this doesn't gonna work when safe mode is on..!

Generating a psudo-random unique key doesn't seem to be something PHP does
well. I can post an extension this afternoon if anyone wants to use it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux