我正面临一个非常奇怪的¿错误?现在在 mysql+php 上。是一个简单的选择,在以下示例中,我使用多个字段来尝试解释我的问题:
- “字段”是 11.5
- $phpvar 是 1.15
MySQL查询:
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 ...
好的,我正在尝试获得 13.23。"field" * $phpvar = 13.225
,所以使用 round(13.225,2) 我应该得到 13.23,对吗?好吧,是的,也不是。
查询结果:
- 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 (无圆)
我错过了什么?怎么可能,在使用“场”时,我的结果是假的?