Hello All,
is it possible to generate unique IDs in php for each row in database. That id should not repeat even if there are 1000s of entries?
Thanks
Shail
Hello All,
is it possible to generate unique IDs in php for each row in database. That id should not repeat even if there are 1000s of entries?
Thanks
Shail
Can just set the id column as auto_increment
Actually i have table where i need two columns for ID. One is already set to incremental. Second can be too, but i want to use md(5) on it before entering it to database
md5 does NOT produce unique values - it takes an infinite range of source values and maps them to a limited range of output values with many inputs mapping to the same output. The only thing it guaranteesis that similar inputs will map to completely different outputs.
Seeems to me you could specify the db fields as UNIQUE and with a bit of exception handling for the rare clash that should work.
Hi… actually i was saying that after generating the unique value, i will use md(5) on it, not to generate it.
If you use mysql, there is a UUID() function that will generate a unique key
In that case there is no need for the original value to be unique since it will no longer be unique after you md5 it.