Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(1);
- require 'config.php';
- $sql="select * from siswa";
- $q=$mysqli->query($sql);
- if(!$q)
- {
- die($mysqli->error);
- }
- $n=0;
- $s='<table>';
- while ($row = $q->fetch_assoc())
- {
- $s.="\n<tr>";
- $s.="\n\t<td>$row[nis]</td>";
- $s.="\n\t<td>$row[nama]</td>";
- for($i=7;$i<=12;$i++)
- {
- $i2=spp($row[nis],$i);
- $s.="\n\t<td>Rp ".number_format($i2)."</td>";
- $aTot[$i]+=$i2;
- }
- for($i=1;$i<7;$i++)
- {
- $i2=spp($row[nis],$i);
- $s.="\n\t<td>Rp ".number_format($i2)."</td>";
- $aTot[$i]+=$i2;
- }
- $s.="\n\t</tr>";
- echo $s;$s='';
- }
- $s.="\n<tr>";
- $s.="\n\t<td colspan=2>JUMLAH</td>";
- for($i=7;$i<=12;$i++)
- {
- $s.="\n\t<td >$aTot[$i]</td>";
- }
- for($i=1;$i<7;$i++)
- {
- $s.="\n\t<td >$aTot[$i]</td>";
- }
- $s.="</tr>";
- $s.="</table>";
- echo $s;$s='';
- function spp($nis,$bulan)
- {
- global $mysqli;
- $sql="
- where nis='$nis' and bulan='$bulan' ";
- $q=$mysqli->query($sql);
- if(!$q)
- {
- die($mysqli->error);
- }
- $n=0;
- $row = $q->fetch_assoc())
- return $row[jumlah_bayar];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement