I'm having a problem comparing two numbers, here's my code:
// Valor
$total_ch = 691.11;
// Calcula valor total das contas a receber
$result = $mysqli->query("SELECT SUM(valor) FROM contas_receber where status = '1' and id IN ($contas)");
$row = mysqli_fetch_array($result);
$valor_contas = $row['SUM(valor)'];
// Verifica se o total dos cheques e maior que os das contas a receber
if ($valor_contas > $total_ch) {
// Exibe Alert
echo "erro";
}
The value returned from $row['SUM(valor)']
is 691.11. So the two values are the same, but the system is pointing out that valor_contas
is greater than total_ch
.
What's causing this? How to solve?