<?php
include('koneksi.php');
//echo "<script>console.log(".$_GET['tgl1'].")</script>";
$query = mysql_query("SELECT * FROM datakaryawan a inner join absenkaryawan b
on a.id_karyawan = b.id_karyawan
where date_format(b.tanggal, '%d-%m-%Y') BETWEEN '".$_GET['tgl1']."' AND '".$_GET['tgl2']."'
ORDER BY b.tanggal") or die
(mysql_error());
if(mysql_num_rows($query) == 0 ){
echo '<tr><td colspan ="6">Tidak Ada Data!</td></tr>';
}else{
$no =1;
while($data = mysql_fetch_assoc($query))
{
echo '<tr>';
echo '<td align="center">'.$no.'.</td>';
echo '<td>'.$data['kode'].'</td>';
echo '<td>'.$data['nama_karyawan'].'</td>';
echo '<td>'.$data['jenis_kelamin'].'</td>';
echo '<td>'.$data['tanggal_lahir'].'</td>';
echo "<td><img src='images".$data['foto']."' width='100' height='80'></td>";
echo '<td>'.$data['kehadiran'].'</td>';
echo '</tr>';
$no++;
}
}
?>
Asked
Active
Viewed 62 times
0

Joseph_J
- 3,654
- 2
- 13
- 22
-
`$_GET['tgl1']` is creating problem for you use `isset($_GET['tgl1'])` and if the value is set in your get variable use it. Also, try to avoid direct assignment of `$_GET` variable in your query. – Ankur Tiwari Jan 25 '19 at 03:30
-
5Possible duplicate of ["Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" using PHP](https://stackoverflow.com/questions/4261133/notice-undefined-variable-notice-undefined-index-and-notice-undefined) – Jan 25 '19 at 03:39