mySQL number erro.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
someberry
Forum Contributor
Posts: 172
Joined: Mon Apr 11, 2005 5:16 am

mySQL number erro.

Post by someberry »

I have a small script that adds a certain amount to a number already in a database. It works fine, until it gets to large numbers, such as 100000000000, where is changes to something like: 1.0000000000e+22.

I am using a `text`column for this, it has to be a `text`, it can't be `int` or other numeric fields.

Does anyone know of any ways around this so it displays the correct number without the e+22 etc?

Thanks,
Someberry.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

research large integer libraries. That value goes outside the range of a "standard" integer (32 bits)
someberry
Forum Contributor
Posts: 172
Joined: Mon Apr 11, 2005 5:16 am

Post by someberry »

I looked on Google, but couldnt find anything to help me. Is there anyway to make them 64bit, 128bit etc whithout having to add any modules to PHP/mySQL?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you don't necessarily have to install any modules, you just need a library that can perform all the tasks you want on much larger integer sets.


http://php.net/gmp
Post Reply