jordanwb Posted June 12, 2008 Share Posted June 12, 2008 Where does the three come in? For example in phpmyadmin, if I create a field with an unsigned TinyInt, its length defaults to three. Unsigned TinyInt goes from 0-255. Any number in that range takes up 8 bits. So where does the Length come into play? Link to comment https://forums.phpfreaks.com/topic/109964-solved-unsigned-tinyint-goes-from-0-255-but/ Share on other sites More sharing options...
Barand Posted June 12, 2008 Share Posted June 12, 2008 255 is three digits Link to comment https://forums.phpfreaks.com/topic/109964-solved-unsigned-tinyint-goes-from-0-255-but/#findComment-564328 Share on other sites More sharing options...
jordanwb Posted June 12, 2008 Author Share Posted June 12, 2008 Yeah but if I put in 256 (which requires 9 bits), I get this warning: Warning: #1264 Out of range value adjusted for column 'fgn' at row 1 and goes down to 255 Link to comment https://forums.phpfreaks.com/topic/109964-solved-unsigned-tinyint-goes-from-0-255-but/#findComment-564365 Share on other sites More sharing options...
Barand Posted June 12, 2008 Share Posted June 12, 2008 As you stated, max value for unsigned tinyint is 255. http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html Link to comment https://forums.phpfreaks.com/topic/109964-solved-unsigned-tinyint-goes-from-0-255-but/#findComment-564372 Share on other sites More sharing options...
jordanwb Posted June 12, 2008 Author Share Posted June 12, 2008 Yes but where does the 3 come in? Link to comment https://forums.phpfreaks.com/topic/109964-solved-unsigned-tinyint-goes-from-0-255-but/#findComment-564380 Share on other sites More sharing options...
Barand Posted June 12, 2008 Share Posted June 12, 2008 255 is three digits If you don't believe me, count them yourself 2...5...5 Link to comment https://forums.phpfreaks.com/topic/109964-solved-unsigned-tinyint-goes-from-0-255-but/#findComment-564387 Share on other sites More sharing options...
jordanwb Posted June 12, 2008 Author Share Posted June 12, 2008 So an unsigned TinyInt3 means that the maximum value is any value that can fit into 8 bits and is at most 3 digits long. Link to comment https://forums.phpfreaks.com/topic/109964-solved-unsigned-tinyint-goes-from-0-255-but/#findComment-564396 Share on other sites More sharing options...
fenway Posted June 13, 2008 Share Posted June 13, 2008 So an unsigned TinyInt3 means that the maximum value is any value that can fit into 8 bits and is at most 3 digits long. Ignore the 3, it's meaningless. it's dispaly width. Link to comment https://forums.phpfreaks.com/topic/109964-solved-unsigned-tinyint-goes-from-0-255-but/#findComment-564769 Share on other sites More sharing options...
jordanwb Posted June 13, 2008 Author Share Posted June 13, 2008 Ok. Link to comment https://forums.phpfreaks.com/topic/109964-solved-unsigned-tinyint-goes-from-0-255-but/#findComment-565012 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.