Jump to content

[SOLVED] php numbers


grlayouts

Recommended Posts

You will want to change the datatype of the column that holds that value to a: UNSIGNED INT or BIGINT

 

I'd go with unsigned int IF the values won't go into the negatives.

 

These are the minimums and maximums of these datatypes. I'm guessing your current datatype is of type INT.

 

INT                -  -2147483648  to  2147483648

UNSIGNED INT  - 0  to  4294967295

BIGINT            - -9223372036854775808 to 9223372036854775807

 

You could do varchar or text as sw0o0sh suggested. But seeing that the data you are storing there is a numerical value, it might be better optimized and faster to use one of the above mentioned numerical datatypes.

Link to comment
https://forums.phpfreaks.com/topic/48670-solved-php-numbers/#findComment-238401
Share on other sites

BIGINT would satisfy your needs, and at the same time be a lot better than varchar or text.

 

You're dealing with numbers, numeric datatypes are best for numbers.

 

If you need larger than an UNSIGNED BIGINT (maximum is: 18446744073709551615), then it would probably be faster to segment the total between more than one row or something of the sort.

 

BIGINT fields are 8 bytes

And UNSIGNED INT fields are 4 bytes.

 

TEXT fields are 2 bytes + the length of the string

VARCHAR fields is 1 byte + the length of the string

 

Logically, if the digits go over 4 or 8 digits, which it has, then it would be better to use UNSIGNED INT or BIGINT, respectively.

Link to comment
https://forums.phpfreaks.com/topic/48670-solved-php-numbers/#findComment-238411
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.