Advertisement
cahyadsn

Penjumlahan Akumulatif

Jul 9th, 2015
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. //..
  2. $hasil = $connect->QUERY('SELECT * FROM data_bca');
  3. $rows = $hasil->fetch_all(MYSQLI_ASSOC);
  4. $no = $total = 0;
  5. ?>
  6. <table>
  7.   <thead>
  8.     <tr>
  9.       <th>No</th>
  10.       <th>Nama Pengirim</th>
  11.       <th>Cabang</th>
  12.       <th>Jumlah</th>
  13.       <th>Keterangan</th>
  14.       <th>Aksi</th>
  15.     </tr>
  16.   </thead>
  17.   <tbody>
  18. <?php
  19. foreach($rows as $rows){
  20.     $total += $rows['jumlah'];
  21. ?>
  22.   <tr>
  23.     <td><?php echo ++$no;?></td>
  24.     <td><?php echo $rows['nama'];?></td>
  25.     <td><?php echo $rows['cabang'];?></td>
  26.     <td><?php echo number_format($rows['jumlah'], 2, ',', '.');?></td>
  27.     <td><?php echo $rows['keterangan'];?></td>
  28.   </tr>
  29. <?php
  30. }
  31. ?>
  32.   </tbody>
  33.   <tfoot>
  34.     <tr>
  35.       <td colspan='3'><label>ST</label></td>
  36.       <td colspan='2'>
  37.         <input type="text" name="Subtotal" value="<?php echo number_format($total,2,',','.'); ?>"/>
  38.       </td>
  39.     </tr>
  40.   </tfoot>
  41. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement