Am I facing a really weird mistake? on mysql + php right now. It is a simple choice, in the following example I use several fields to try to explain my problem:
- "field" - 11.5
- $ phpvar - 1.15
MySQL query:
select round(field * " . $phpvar . " ,2) as a1,
round(field * 1.15 ,2) as a2,
round(11.5 * " . $phpvar . " ,2) as a3,
round(11.5 * 1.15 ,2) as a4,
field * " . $phpvar . " as a5
from ...
OK, I'm trying to get 13.23. "field" * $phpvar = 13.225, therefore, using round (13.225,2), I have to get 13.23, right? Well, yes and no.
query result:
- a1 [round (field * ". $ phpvar.", 2)] => 13.22
- a2 [round (field * 1.15, 2)] => 13.22
- a3 [round (11.5 * ". $ phpvar.", 2)] => 13.23
- a4 [round (11.5 * 1.15, 2)] => 13.23
- a5 [field * ". $ phpvar." ] => 13.225 (no round)
? , "", ?