[PHP] Re: customer ids

2007-06-06 Thread Burn
blueboy ha scritto: Hi, I want to create random customer ids. I have an auto incremented coulumn but I would rather have a 6-8 digit/letter id randomly generated that can be used as a unique identifier across 3 tables. Does anyone have a algorithm to generate such a string and can you give

Re: [PHP] Re: customer ids

2007-06-06 Thread Richard Davey
Hi Burn, Wednesday, June 6, 2007, 3:55:21 PM, you wrote: Here's how I do it, for 1 single table though.. you'll have to write yourself the mod to check on more tables. If you plan to have 10 millions records make sure the maxrand is higher. When the do loop exits you have a unique id.

Re: [PHP] Re: customer ids

2007-06-06 Thread Burn
Richard Davey ha scritto: Hi Burn, Wednesday, June 6, 2007, 3:55:21 PM, you wrote: Here's how I do it, for 1 single table though.. you'll have to write yourself the mod to check on more tables. If you plan to have 10 millions records make sure the maxrand is higher. When the do loop

Re[2]: [PHP] Re: customer ids

2007-06-06 Thread Richard Davey
Hi Burn, Wednesday, June 6, 2007, 4:39:05 PM, you wrote: Worst thing that can happen is having mysql throw an error while trying to insert an ID that's already present in the database. It gets more complicated and unpredictable if the field isn't required to be unique at database design

Re: [PHP] Re: customer ids

2007-06-06 Thread Burn
Richard Davey ha scritto: Hi Burn, Wednesday, June 6, 2007, 4:39:05 PM, you wrote: Worst thing that can happen is having mysql throw an error while trying to insert an ID that's already present in the database. It gets more complicated and unpredictable if the field isn't required to be