hello
i need to create a hex unique keys that will not be limited, I am creating this for activation codes that needs to created for example 5000 cds.
was thinking of using the primary key (since it is unique already), md5 it and then reverse it. but need to create two codes one for product key and one for activation.
only problem is there should be only 6 chars in the code, what approach can i use here?
or any help / tutorials etc. will be greatly appreciated.
what i was thinking of ->
$sql = 'SELECT count(id) FROM table';
...
$num = @mysql_num_rows($rs);
...
//next number
$nextNumber = $num + 1;
// would this work in getting the next id?
$code = md5($nextNumber);
// now i need to take 6 chars out od the hex somewhere which will be
// unique everytime, but how?
$code = substr($code,0,6);