Pls I wnt to generate a unique random num (not saved in MySQL) using either JavaScript or PHP, should b saved in MySQL database. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Pls I wnt to generate a unique random num (not saved in MySQL) using either JavaScript or PHP, should b saved in MySQL database.

26th Oct 2022, 12:32 AM
El-Sheikh Ibrahim Abba
El-Sheikh Ibrahim Abba - avatar
2 Answers
+ 2
UUID means 'universally unique identifier'. It is precisely what you described, a commonly applied technique to generate large unique random numbers. Typically there are built-in data types and functions to generate this in most programming languages. You can even delegate the creation to MySQL natively, with the built-in uuid() function. I would prefer this option. But if you want to do it in another language, you can research how to do that. https://dev.mysql.com/blog-archive/storing-uuid-values-in-mysql-tables/
26th Oct 2022, 2:51 AM
Tibor Santa
Tibor Santa - avatar
+ 1
"Pls I want to generate ... (not saved in MySQL) ... , should be saved in MySQL database" Is it to be saved in database or not? I suggest you to fix the post title to be clear about whether or not to save that random number ...
26th Oct 2022, 2:11 AM
Ipang