View Single Post
  #1 (permalink)  
Old 11-15-2005, 04:21 PM
wsmeyer wsmeyer is offline
WebProWorld Pro
 
Join Date: Feb 2005
Location: United States
Posts: 113
wsmeyer RepRank 0
Default Trouble adding numbers with 12 decimals in PHP and MySQL

In my database I have numbers stored as decimal(16,12) like this:

1.000100000000
3.000100010001
10.000500020003

If I just grab them and echo them to the screen they return correctly but if I try to get the sum of them either in MySQL using

sum(nums) AS num

or grabbing them and then with PHP looping through them and using

$tot +=

they do not add correctly and it is DRIVING ME CRAZY :)

If anyone has any ideas I'd really appreciate a point in the right direction.

William.
Reply With Quote