I'd like to have my primary keys be random numbers between 1000 and 9999. Is there any way to do that?
I don't know if there is direct way to do this in mysql, but it can be done by PHP:
srand(time()); $temp_id = rand(1000,9999)
And then check if it is used as entry of the primary key, if not, use it!
Have a nice day!!
maybe a little out of what u wanted...but i think that incrementing the value by 1 each time is not too bad an idea..unless the records are deleted pretty often 🙂