mpsn Posted June 29, 2011 Share Posted June 29, 2011 Hi, I"m trying to create a simple online buying site and I have a unique ID as well as a unique IMEI (it is the identification number used on cellular phones) that I want also to be unique but I want to choose the starting value to be some big number like 1000000000000000 (16 digit value), I think this is a simple question, I'm using phpmyadmin if that helps btw. Quote Link to comment https://forums.phpfreaks.com/topic/240738-how-to-choose-initial-value-for-auto-incrementing-field/ Share on other sites More sharing options...
Maq Posted June 29, 2011 Share Posted June 29, 2011 I think this is a simple question What is? I don't see any questions. Do you need help building the id, storing it, what is the problem? Quote Link to comment https://forums.phpfreaks.com/topic/240738-how-to-choose-initial-value-for-auto-incrementing-field/#findComment-1236495 Share on other sites More sharing options...
requinix Posted June 29, 2011 Share Posted June 29, 2011 Why 16 digits? Does it have to be that long? Are you trying to obscure something? Quote Link to comment https://forums.phpfreaks.com/topic/240738-how-to-choose-initial-value-for-auto-incrementing-field/#findComment-1236497 Share on other sites More sharing options...
mpsn Posted June 29, 2011 Author Share Posted June 29, 2011 I was trying to go for more authenticity since actual cellular phones have this IMEI (ID number) being that long, but I can go shorter if that's the case, just let me know how, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/240738-how-to-choose-initial-value-for-auto-incrementing-field/#findComment-1236499 Share on other sites More sharing options...
Maq Posted June 29, 2011 Share Posted June 29, 2011 I was trying to go for more authenticity since actual cellular phones have this IMEI (ID number) being that long, but I can go shorter if that's the case, just let me know how, thanks. The number is depends on what YOU want. What is this for? If this is just a unique identifier then use an auto-incremented field and start at 1. Quote Link to comment https://forums.phpfreaks.com/topic/240738-how-to-choose-initial-value-for-auto-incrementing-field/#findComment-1236501 Share on other sites More sharing options...
mpsn Posted June 29, 2011 Author Share Posted June 29, 2011 So not possible to have this auto incrementing digit start at a number I want? Quote Link to comment https://forums.phpfreaks.com/topic/240738-how-to-choose-initial-value-for-auto-incrementing-field/#findComment-1236502 Share on other sites More sharing options...
Maq Posted June 29, 2011 Share Posted June 29, 2011 So not possible to have this auto incrementing digit start at a number I want? It is possible. Read the manual - http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html To start with an AUTO_INCREMENT value other than 1, you can set that value with CREATE TABLE or ALTER TABLE, like this: mysql> ALTER TABLE tbl AUTO_INCREMENT = 100; Quote Link to comment https://forums.phpfreaks.com/topic/240738-how-to-choose-initial-value-for-auto-incrementing-field/#findComment-1236503 Share on other sites More sharing options...
requinix Posted June 29, 2011 Share Posted June 29, 2011 Note that you'll need a BIGINT/SERIAL column (as INTs only go to 10 digits). We're asking because this "authenticity" might not actually be necessary. Quote Link to comment https://forums.phpfreaks.com/topic/240738-how-to-choose-initial-value-for-auto-incrementing-field/#findComment-1236505 Share on other sites More sharing options...
mpsn Posted June 29, 2011 Author Share Posted June 29, 2011 or is there a numerical data type that can hold 16 digits, like double or big int? Quote Link to comment https://forums.phpfreaks.com/topic/240738-how-to-choose-initial-value-for-auto-incrementing-field/#findComment-1236508 Share on other sites More sharing options...
xyph Posted June 29, 2011 Share Posted June 29, 2011 You can always just store it as auto increment, starting at 1. Before you display it, add some arbitrary number, say 1432564 to it. Just subtract that number when you want to query the DB. Quote Link to comment https://forums.phpfreaks.com/topic/240738-how-to-choose-initial-value-for-auto-incrementing-field/#findComment-1236522 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.