visitor Posted January 26, 2012 Share Posted January 26, 2012 Hi I would like to have an ID entered in this format xx.000'000 what kind of type is probably best suited (INT, TEXT, VARCHAR?) any help is highly appreciated visitor Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 26, 2012 Share Posted January 26, 2012 What kind of ID? Not a primary key for a database table, I hope. Quote Link to comment Share on other sites More sharing options...
visitor Posted January 26, 2012 Author Share Posted January 26, 2012 No, of course not... the primary key is 1, but I would like in cust-id to show up i.e. xx.000'000 for the first customer, xx.000'001 for the next etc. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 27, 2012 Share Posted January 27, 2012 I suppose you could set the PK field to INT(6) UNSIGNED ZEROFILL, use number_format to make the thousands separator an apostrophe, and concatenate the xx. to the front of it, but to me that all seems unnecessary. I'd simply use the PK as the customer id. Quote Link to comment Share on other sites More sharing options...
fenway Posted January 27, 2012 Share Posted January 27, 2012 Feel free to format the ID however you'd like -- but don't corrupt the DB. Quote Link to comment Share on other sites More sharing options...
visitor Posted January 27, 2012 Author Share Posted January 27, 2012 OK, great! Thanks to both of you and especially for your description Pikachu2000. I really appreciate it visitor Quote Link to comment 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.