Best way to insert unique random ID in MySQL/PHP?-ThrowExceptions

Exception or error:

I’ve seen many ways to do this but I’d like to know which one would be the best. I’m working on a school project, so the security isn’t that important but the ID should also be impossible to just quess.

I tried using UUID_SHORT() in MySQL but the number it returns are not really random (98638978307063816, 98638978307063817…)

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *