MySQL

MySQL generate random number not IN table1 min read

In an application I made last week, I needed a random id value that was not registered in the database.

I found a solution for the problem I had on the Overflowstack site.




I’m sharing the code here as a note to myself.

Output:

4521

Source: https://stackoverflow.com/questions/11680025/how-to-generate-random-number-without-repeat-in-database-using-php

Leave a Comment