number_format() buggy round when usind database resultset

From: Date: Thu, 25 Jan 2001 20:46:07 +0000
Subject: number_format() buggy round when usind database resultset
Groups: php.general 
Request: Send a blank email to php-general+get-36697@lists.php.net to get a copy of this message
Hi, 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? :) Thanks, -- Lucas Persona lpersona@widesoft.com.br

« previous php.general (#36697) next »