<?php
include "koneksi.php";

header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=data_pengaduan.xls");

echo "<table border='1'>
<tr>
<th>Nama</th>
<th>Kelas</th>
<th>Konsentrasi Keahlian</th>
<th>Masalah</th>
<th>Tanggal</th>
</tr>";

$data = mysqli_query($koneksi, "SELECT * FROM pengaduan");

while ($d = mysqli_fetch_assoc($data)) {
  echo "<tr>
    <td>".$d['nama']."</td>
    <td>".$d['kelas']."</td>
    <td>".$d['konsentrasikeahlian']."</td>
    <td>".$d['masalah']."</td>
    <td>".$d['tanggal']."</td>
  </tr>";
}

echo "</table>";
exit;
?>