Mike Fifield wrote: > I am using the mysql sum() function to return the "sum" of a bunch of dolor > amounts stored "float" values. But what I get back it something like this > "98.199998855591" it is to precise. All I want is the dolor amounts added up > and rounded up to the closest penny. Is there a better value type to use or > a function that will return the information properly formatted. > > Mike Fifield > Charles Schwab & Co, Inc. > WARNING: All e-mail sent to or from this address will be received by the > Charles Schwab corporate e-mail system and is subject to archival and review > by someone other than the recipient. > >
MySQL has a decimal column type which allows you to specify to how many decimal points the number is stored. http://www.mysql.com/doc/C/o/Column_types.html If you want to do it via PHP, you can format the number via number_format() and that will give you the 2 decimal points as well as the commas where needed. Also, both PHP and MySLQ have round() functions to format the numbers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php