39 lines
1.6 KiB
PHP
39 lines
1.6 KiB
PHP
<?php
|
|
include 'connectDB.php';
|
|
|
|
$rfid_search = isset($_POST['rfid']) ? $_POST['rfid'] : '';
|
|
$start_date = isset($_POST['start_date']) ? $_POST['start_date'] : '';
|
|
$end_date = isset($_POST['end_date']) ? $_POST['end_date'] : '';
|
|
|
|
if (!empty($rfid_search) && !empty($start_date) && !empty($end_date)) {
|
|
$sql = "SELECT *, IF(rekap_keluar='00:00:00', '', rekap_keluar) AS keluar
|
|
FROM data_absen
|
|
WHERE idrfid='$rfid_search' AND tgl BETWEEN '$start_date' AND '$end_date'
|
|
ORDER BY tgl DESC"; // Menambahkan perintah untuk mengurutkan data berdasarkan tanggal secara descending
|
|
$result = mysqli_query($conn, $sql);
|
|
|
|
if ($result && mysqli_num_rows($result) > 0) {
|
|
echo '<table cellpadding="0" cellspacing="0" border="0">
|
|
<tbody>';
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
?>
|
|
<tr>
|
|
<td class="text-center"><?php echo $row['tgl']; ?></td>
|
|
<td class="text-center"><?php echo $row['idrfid']; ?></td>
|
|
<td class="text-center"><?php echo $row['rekap_masuk']; ?></td>
|
|
<td class="text-center"><img src="images/photos/<?php echo $row['gambar1']; ?>" width="100px"></td>
|
|
<td class="text-center"><?php echo $row['keluar']; ?></td>
|
|
<td class="text-center"><img src="images/photos/<?php echo $row['gambar2']; ?>" width="100px"></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
echo '</tbody>
|
|
</table>';
|
|
} else {
|
|
echo "Data RFID tidak ditemukan dalam rentang tanggal yang diberikan.";
|
|
}
|
|
} else {
|
|
echo "Masukkan RFID dan rentang tanggal.";
|
|
}
|
|
?>
|