Re: [PHP] Re: Random Unique ID

2007-03-23 Thread Richard Lynch
On Wed, March 21, 2007 5:40 pm, [EMAIL PROTECTED] wrote: > Thanks. Yes, I check for errors. But there are other types of errors > so I'd need to verify that it is a duplicate key error and, in my > ignorance, I have not yet figured out how to do that programatically. > I worry about getting into

Re: [PHP] Re: Random Unique ID

2007-03-23 Thread Satyam
abase engine that supports replication, since that's the only way to ensure keys won't get repeated over multiple servers. Satyam - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Friday, March 23, 2007 7:48 PM Subject: [PHP] Re: Random Unique ID Robert C

[PHP] Re: Random Unique ID

2007-03-23 Thread ccspencer
Robert Cummings writes: Bleh, you can solve this with at most 2 queries. Thanks. That is a bit different than what I was thinking about but it might work for my purposes. Thanks also to all the other people who made suggestions. It appears to me that ther are 3 distinct approaches. 1) Ge

[PHP] Re: Random Unique ID

2007-03-22 Thread Mark
[EMAIL PROTECTED] 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 >

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Mark
Tijnema ! wrote: > On 3/22/07, markw@mohawksoft.com wrote: >> > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> >> # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: >> >> > Tijnema ! wrote: >> >> > >> >> > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> >> > >> >> >> > >>

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Tijnema !
On 3/22/07, markw@mohawksoft.com wrote: > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: >> > Tijnema ! wrote: >> > >> > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> > >> >> > >> http://www.ossp.org/pkg/lib/uuid >> > >

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread markw
> On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: >> > Tijnema ! wrote: >> > >> > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> > >> >> > >> http://www.ossp.org/pkg/lib/uuid >> > > >> > > Note that this doesn't gonna work w

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Tijnema !
On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: # markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: > Tijnema ! wrote: > > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: > >> > >> http://www.ossp.org/pkg/lib/uuid > > > > Note that this doesn't gonna work when safe mode is on..!

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Roman Neuhauser
# markw@mohawksoft.com / 2007-03-22 08:49:59 -0400: > Tijnema ! wrote: > > > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: > >> > >> http://www.ossp.org/pkg/lib/uuid > > > > Note that this doesn't gonna work when safe mode is on..! Ralf S. Engelschall's OSSP UUID library wrapped in a P

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Mark
Tijnema ! wrote: > On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: >> # [EMAIL PROTECTED] / 2007-03-21 21:03:35 -0500: >> > Mark wrote: >> > >[EMAIL PROTECTED] wrote: >> > > >> > >>Hello, >> > >> >> > >>I want to add a random unique ID to a Mysql table. Collisions >> > >>are unlikely but p

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Tijnema !
On 3/22/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote: # [EMAIL PROTECTED] / 2007-03-21 21:03:35 -0500: > Mark wrote: > >[EMAIL PROTECTED] 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

Re: [PHP] Re: Random Unique ID

2007-03-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-03-21 21:03:35 -0500: > Mark wrote: > >[EMAIL PROTECTED] 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 collisi

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Robert Cummings
On Thu, 2007-03-22 at 08:14 +0400, Rabih Tayyem wrote: > Actually I told you that the possibility of collision is small because I > wanted to be scientific > Scientifically, I can say this posibilty goes to 0... Only as the length of the ID approaches infinity :B Cheers, Rob. -- .---

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Rabih Tayyem
Actually I told you that the possibility of collision is small because I wanted to be scientific Scientifically, I can say this posibilty goes to 0... It is a random ID (not a totally random but based on the current timestamp) generated not only once but twice based on two different time s

[PHP] Re: Random Unique ID

2007-03-21 Thread Myron Turner
Mark wrote: [EMAIL PROTECTED] 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

[PHP] Re: Random Unique ID

2007-03-21 Thread Mark
[EMAIL PROTECTED] 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 >

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Robert Cummings
On Wed, 2007-03-21 at 16:40 -0600, [EMAIL PROTECTED] wrote: > Jim Moseby writes: > > >> However, altho I know that by making the random number big enough > >> the likelyhood of collisions can be made vanishingly small, I was > >> actually concerned with eliminating the possibility of collisions >

[PHP] Re: Random Unique ID

2007-03-21 Thread ccspencer
Jim Moseby writes: However, altho I know that by making the random number big enough the likelyhood of collisions can be made vanishingly small, I was actually concerned with eliminating the possibility of collisions altogether by checking to see if the number had been used before. I just do

Re: [PHP] Re: Random Unique ID

2007-03-21 Thread Stut
[EMAIL PROTECTED] wrote: Stut writes: [EMAIL PROTECTED] wrote: 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 newb

RE: [PHP] Re: Random Unique ID

2007-03-21 Thread Jim Moseby
> Rabih Tayyem writes: > > > PS: I don't take credit for the code as it is a modified version of > > a code I found long time back (this same code is running on one of > > my applications for months without any problem).. > > Thanks. I'll find use for that! > > However, altho I know that by

[PHP] Re: Random Unique ID

2007-03-21 Thread ccspencer
Rabih Tayyem writes: PS: I don't take credit for the code as it is a modified version of a code I found long time back (this same code is running on one of my applications for months without any problem).. Thanks. I'll find use for that! However, altho I know that by making the random num

[PHP] Re: Random Unique ID

2007-03-21 Thread ccspencer
Stut writes: [EMAIL PROTECTED] wrote: 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