예제 #1
0
    die('Connect Error (' . $mysqli->connect_error . ') ');
}
#akhir koneksi
#ambil data
$tgl1 = $_POST['tgl1'];
$tgl2 = $_POST['tgl2'];
$query = "select m.nim,m.nama,m.tempat,m.photo_url,m.no_hp,m.alamat,t.no, t.tgl_masuk,t.keperluan,t.foto_wajah,t.lantai,t.lokasi,t.id_visitor,t.status\n                                  FROM tblmhs m LEFT JOIN tbl_tamu t ON m.nim = t.no_id\n                                  WHERE t.tgl_masuk BETWEEN '{$tgl1}' AND '{$tgl2}'";
$sql = $mysqli->query($query);
$arrmhs = array();
while ($row = $sql->fetch_assoc()) {
    array_push($arrmhs, $row);
}
#akhir data
$excel = new Excel();
#Send Header
$excel->setHeader('Report_Buku_Tamu.xls');
$excel->BOF();
#header tabel
$excel->writeLabel(0, 0, "No. ID");
$excel->writeLabel(0, 1, "NAMA");
$excel->writeLabel(0, 2, "PERUSAHAAN");
$excel->writeLabel(0, 3, "PHOTO URL");
$excel->writeLabel(0, 4, "NO HP");
$excel->writeLabel(0, 5, "ALAMAT");
$excel->writeLabel(0, 6, "LANTAI");
$excel->writeLabel(0, 7, "ID VISITOR");
$excel->writeLabel(0, 8, "LOKASI");
#isi data
$i = 1;
foreach ($arrmhs as $baris) {
    $j = 0;