3
I’m making a query, which gets 2 values from the database. It returns the correct values with comma. But when multiplication is done, it is not counting the decimal places.
foreach ($compra['CompraItem'] as $valores) {
$cotacao = $modeloMoedaCotacao->find('first', array('conditions'=>array(
'MoedaCotacao.moeda_id' => $valores['moeda_id'],
'MoedaCotacao.data' => date("Y-m-d"),
), array(
'limit' => 1,
)));
echo $cotacao = FloatFromSQL($cotacao['MoedaCotacao']['cotacao']);
echo '<br />';
echo $valor = FloatFromSQL($valores['valor']);
echo '<br />';
$valorTotal = $valor * $cotacao;
echo $valorTotal;
echo '<br />';
}
Return:
5.14000 1980.00 = multiplication returns without using decimal place >> 9900
3.23000 160,00 = multiplication returns without using decimal place >>480
5.14000 70,00 = multiplication returns without using decimal place >>350
What is the DBMS behind and, more importantly, can tell the type of data being used to store these numbers?
– user25930