Re: number_format() buggy round when usind database resultset

From: Date: Fri, 26 Jan 2001 10:59:33 +0000
Subject: Re: number_format() buggy round when usind database resultset
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36769@lists.php.net to get a copy of this message
> I'm finding some problems on using number_format($value, $decimal, ",", > ".") when I have a value comming from a resultset (database query > results)... > If I had something like '123.45', using number_format it will return > '123,00'. > I think this happens because my value is a string and PHP rounds it > before using it on number_format. If I try to change the data type like > (double) $value, I will also have a '123.00' result. > I could do something on database like 'to_char(FIELD, '999G999D99') but > database default is '.' for decimal separator and ',' for thousand > separator...and I want the opposite. > Suggestions/Solutions? :) Your database may have a number_format() function that can better interact with the internal data of the database. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#36769) next »