Posted by mantrid on 10/07/06 18:36
I am trying to take an integer and divide it by 100 to give a decimal to
store in my database. The field in my mysql database is set to decimal(4,2)
My php is
$price=number_format($price/100,2);
Ive also tried
$price=number_format($price,2)/100;
but neither work it keeps rounding any value less than 100 to 1 whereas I
want it to store the value to two DP
eg
80 becomese 1 instead of 0.8
180 becomes 2 instead of 1.8
does anyone know how to do this?
Ian
[Back to original message]
|