Forum Moderators: coopster
I am creating an affiliate system for a website and am a bit stuck as to how to generate a unique id for each affiliate when they register.
In my mysql table I will have a unique 'id' (auto inc) and I then want to have an affiliate_id column. Can I get the DB to give auto increment the id numberr using these letters beforfe the id number 'aff-'
example:
aff-1
aff-2
aff-3
Or should I use php to generate this?
You may try one of the following:
a) get the auto-id from db and construct you own unique id (like your example aff-3 if your auto-id is 3)
b) get your PHPSession id and store it
c) construct your own session id-like string with something like
$session_id="";
srand((double)microtime()*1000000);
$session_id = md5(uniqid(rand()));