I think I get what you want now ^^. The table for the unique codes would be generated automatically. Maybe I have some more time later then I will try to help you more