The Little Guy Posted October 17, 2009 Share Posted October 17, 2009 Is there a way to instead of increment 1, 2, 3, 4, 5 etc... It can make a unique id, one that is 6 characters long, and contains uppercase letters A-Z, and numbers 0-9? I will be using php MyAdmin, so this will not be through another interface. Link to comment https://forums.phpfreaks.com/topic/177986-unique-id/ Share on other sites More sharing options...
GoneNowBye Posted October 17, 2009 Share Posted October 17, 2009 Yes set youre primary key to "varchar6" and uncheck autoincrement? or create another index with "key" as the field name and index that against ID (For efficency) Link to comment https://forums.phpfreaks.com/topic/177986-unique-id/#findComment-938436 Share on other sites More sharing options...
The Little Guy Posted October 17, 2009 Author Share Posted October 17, 2009 Yes set youre primary key to "varchar6" and uncheck autoincrement? How would that create a unique ID? or create another index with "key" as the field name and index that against ID (For efficency) I don't follow... Link to comment https://forums.phpfreaks.com/topic/177986-unique-id/#findComment-938463 Share on other sites More sharing options...
xtopolis Posted October 17, 2009 Share Posted October 17, 2009 TLG, What you propose will not necessarily be an auto-increment type thing. I would suggest that you use both a normal 1->INTLIMIT column as well as the additional "unique" column you are looking for. As for generating that unique key, you could search for functions that meet your specifications... or another idea would be to make it 32 chars loing and make it a hash of certain data in the other columns. Link to comment https://forums.phpfreaks.com/topic/177986-unique-id/#findComment-938482 Share on other sites More sharing options...
GoneNowBye Posted October 17, 2009 Share Posted October 17, 2009 How would that create a unique ID? " quote The index type is primary - therefore unique. The other question has been explained above. Link to comment https://forums.phpfreaks.com/topic/177986-unique-id/#findComment-938762 Share on other sites More sharing options...
The Little Guy Posted October 17, 2009 Author Share Posted October 17, 2009 How would that create a unique ID? " quote The index type is primary - therefore unique. If it was a varchar you would have to manually put something in the field. Any who, I have thought of a new way to do things, kind of like youtube I am using "usernames" and an auto increment. Basically I wanted a way for users to access certain pages without putting an ID number in the address bar but instead use a username (originally it was going to be a unique ID such as: "1S4JKF") to access the page. But I changed my mind, and I am now using a user name instead. Sorry Guys Link to comment https://forums.phpfreaks.com/topic/177986-unique-id/#findComment-938823 Share on other sites More sharing options...
fenway Posted October 17, 2009 Share Posted October 17, 2009 You could have easily mapped a long hexadecimal string. Link to comment https://forums.phpfreaks.com/topic/177986-unique-id/#findComment-938870 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.