How can I generate a unique Key and insert it into my mysql database?
This is what I currently use:
echo uniqid(time(), true);
Can you tell me wether it is a unique key or not?
You can use AUTOINCREMENT on your id field in the database.
It will never get duplicate since it increments the highest existing id present.
you can use following to get unique id with 32 chars
md5(uniqid(time(), true))
or you can use sha1 like with 40 chars
sha1(uniqid(time(), true))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With