Good I am taking out a message in case the client has a pending invoice but at the time to do the sum of the totals I am not able to do that I grouped them. Because if there are two products in an order, two lines are created in the database, so when added, it adds twice the same.
$us = $res['IdUsuario'];
$pedidos = $mysqli->query("SELECT Total, FORMAT(SUM(Total), 2) as suma, estadoFact, Iduser, id, pedidoid FROM pedidos WHERE estadoFact = 0 AND Iduser = $us");
$ped = $pedidos->fetch_array();
$esta = $ped['estadoFact'];
$aban = $ped['abandonado'];
for ($i=0; $i < sizeof($ped['estadoFact']); $i++) {
if($aban[$i] == 0){
echo "<div class=\"col-12 cuadroImpago\">
<h2>Tienes Facturas pendientes</h2>
<p>Dirijete a Facturación y abonalas para impedir cortes de servicio</p>
<h3>" .$ped['suma']."</h3>
</div>";
}
}
The idea of the for is to go through it, but something I will not be doing right.