I would like to create a reference field.
I would like it ti have a fixed number of charaters/numbers, just like the videos reference of YouTube.
Is there a mysql/php function to handle that? I mean a function that generates a unique string that doesn't exist already in the table.
Thanks for the tip.
I have noticed that UUID function returns a always a different string,
but i would like to generate one with a fixed length - 10.
I now i could substring the returned string but that is contrary to what i want - the substring may already exists and i want to generate always a new one. Any idea?
I just used a md5 hash of a input variable and then a substr
of 10 characters. Then i make select on the table to check if is a unique id;
if yes Ok; if no just warn the user to change the input variable.