|
A
|
alang 5/19/2008 |
|
I generally use the "autoincrement" in MySQL for generating a unique key field - it's pretty straightforward and requires no special PHP. What is the advantage in getting 100 random characters? Wouldn't it be less efficient once you got a few records in there - particularly if you have it included in other tables as a foreign key? |
|
|
G
|
gizmoman author 5/20/2008 |
|
The database runs on several machines inclusing ones in my car and they are not all connected together. I use the field to identify records during sync. The auto increment can cause the same number to appear on several databases but in different records I generally use the "autoincrement" in MySQL for generating a unique key field - it's pretty straightforward and requires no special PHP. What is the advantage in getting 100 random characters? Wouldn't it be less efficient once you got a few records in there - particularly if you have it included in other tables as a foreign key? |
|
|
S
|
steveh 5/21/2008 |
|
Random characters can clash as well. |
|
|
G
|
gizmoman author 5/21/2008 |
|
Thanks for the suugestions but no one has simply answered the original question. Random characters can clash as well. Why not just add a source field and use that and the autoincrement field together, source would be "car" or whatever. |
|
|
J
|
Jane 5/22/2008 |
|
Hi, |
|
|
G
|
gizmoman author 5/22/2008 |
|
Thanks heaps. Hi, to generate random number and save it in the field use Before record added event. Use rand() PHP function in it: http://php.net/manual/en/function.rand.php |
|
|
J
|
Jane 5/23/2008 |
|
Hi, |
|