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 Link to comment https://forums.phpfreaks.com/topic/255832-xx000000/ 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. Link to comment https://forums.phpfreaks.com/topic/255832-xx000000/#findComment-1311437 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. Link to comment https://forums.phpfreaks.com/topic/255832-xx000000/#findComment-1311438 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. Link to comment https://forums.phpfreaks.com/topic/255832-xx000000/#findComment-1311574 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. Link to comment https://forums.phpfreaks.com/topic/255832-xx000000/#findComment-1311723 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 Link to comment https://forums.phpfreaks.com/topic/255832-xx000000/#findComment-1311768 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.