|
Posted by Betikci Boris on 02/02/08 14:40
On Feb 1, 5:59 pm, The Natural Philosopher <a...@b.c> wrote:
> The question says it all.
>
> I have an input box, which I fill in with a price.
> IOt gets passed to the main form as a variable, then shoved into an SQL
> field vue a print '%d' statement where the argument is $price*100.
>
> For some reaosn, this particular value goes to 6998.
>
> If I update hee database manually to 6999, it displays as 69.99.
>
> If I enter 69.999 it updates as 6999..not 69999
>
> I must be doing something really dumb here..
it's simply a rounding error! because type float is weak while storing
the numbers with floating points you should store values using type
double or you can divide each part of the number ex. for 89.98 as 89
and 98 you could do this using php's bundled string manipulation
functions..
Navigation:
[Reply to this message]
|