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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.