I'm doing a financial control system, and I've looped while grabbing the client data from a db and it shows them in a table. What I want to do is take the values in the column "PRICE" and add, to give the value of the total of balances. I'm going to put only the part of the relevant code:
<?php
$seleciona="select * from receitas order by nome";
$sql=mysqli_query($con,$seleciona);
while ($inf=mysqli_fetch_row($sql)) {
$cliente=$inf[0];
$data=$inf[1];
$horario=$inf[2];
$preco=$inf[3];
$servico=$inf[4];
echo"
<td class='mdl-data-table__cell--non-numeric'>$cliente</td>
<td class='mdl-data-table__cell--non-numeric'>$data</td>
<td>$horario</td>
<td class='mdl-data-table__cell--non-numeric'>$preco</td>
<td class='mdl-data-table__cell--non-numeric'>$servico</td>
</tr>
";}
?>
What I want to do now is a loop to get the values of the variable "$ price" and add up to put the result of the sum of all values as the total revenue.