Re: Random Unique ID

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

 



At 11:18 AM -0600 3/21/07, 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

Craig:

Simple.

Generate a "random unique ID" via whatever method you want. However, before using, search your dB to see if it's already in use. If it is, then generate another one and repeat.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
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