I have a variable that performs a select function, returning two values from the database:
$grupo = selectContas();
I would like to add these two values and save them to a variable, but only the value of the last record is being saved.
<?php
foreach($grupo as $contas){
$valortotal = '';
$valortotal = $valortotal + $contas["valor"];
}
?>
<?=$valortotal?> (Aqui mostra apenas o último valor do registro)