EchoFool Posted August 26, 2008 Share Posted August 26, 2008 I am trying to insert a value of : 12,020,000,000 And the field format is int(15) Yet when ever i put the number in it limits to : 2,147,483,647 My script is simple: <?php //happy max comes from a query further up $Price = $HappyMax * 119.6; Echo $Price; $Update = mysql_query("UPDATE househappy SET Price = '$Price' WHERE RecordID='$RecordID'") Or die(mysql_error()); ?> When i echo price i get this: 12020000000 But database shows: 2147483647 Why is this? Quote Link to comment https://forums.phpfreaks.com/topic/121461-solved-php-numbers-issue/ Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 The max that an INT can hold is 2,147,483,647, or 2^31 (on 32-bit systems, signed. 64-bit systems hold way more.) Quote Link to comment https://forums.phpfreaks.com/topic/121461-solved-php-numbers-issue/#findComment-626371 Share on other sites More sharing options...
EchoFool Posted August 26, 2008 Author Share Posted August 26, 2008 So it will have to be a string type for field ? Quote Link to comment https://forums.phpfreaks.com/topic/121461-solved-php-numbers-issue/#findComment-626377 Share on other sites More sharing options...
wildteen88 Posted August 26, 2008 Share Posted August 26, 2008 So it will have to be a string type for field ? No, MySQL has another INT dataype which is BIGINT. This can hold a much larger number (-9223372036854775808 to 9223372036854775807) Quote Link to comment https://forums.phpfreaks.com/topic/121461-solved-php-numbers-issue/#findComment-626384 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 Try BIGINT. It holds 92,23,372,036,854,775,807. Just enough. xD EDIT: wildteen beat me to it. *sob* Quote Link to comment https://forums.phpfreaks.com/topic/121461-solved-php-numbers-issue/#findComment-626388 Share on other sites More sharing options...
EchoFool Posted August 26, 2008 Author Share Posted August 26, 2008 Thanks for the info Quote Link to comment https://forums.phpfreaks.com/topic/121461-solved-php-numbers-issue/#findComment-626393 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.