Calculer la sommes des lignes dans un tableau array
Résolu
okbabb
Messages postés
59
Statut
Membre
-
okbabb Messages postés 59 Statut Membre -
okbabb Messages postés 59 Statut Membre -
Bonjour,
J'ai le tableau suivant sur mon travail php:
<?php
$donnee=mysql_query("SELECT *
FROM bons
ORDER BY num_bon ASC;");
?>
<table>
<thead>
<tr>
<th>Num bon</th> <th>Montant bon</th>
</tr>
</thead>
<tbody>
<?php
while($data=mysql_fetch_array($donnee) )
{
echo'<tr>';
echo'<td>'.$data['num_bon'].'</td> <td>'.$data['montant_bon'].'</td>';
echo'</tr>';
}
?>
</tbody>
<tr>
<td>Somme</td> <td>La somme des montant bon</td>
</tr>
</table>
Je ne sais pas comment faire pour mettre dans la dernière colonne de la dernière ligne la somme des montants des bons
<td> la somme des montant bons </td>