<?php
	$conn = new mysqli('localhost', 'root', '', 'db_hrms');

	if ($conn->connect_error) {
	    die("Connection failed: " . $conn->connect_error);
	}
?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.2/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.2/js/buttons.print.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/2.3.2/css/buttons.dataTables.min.css">

<script type="text/javascript">
	$(document).ready(function() {
    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
           /* 'copy', 'csv', 'excel', 'pdf', 'print'*/
           'copy', 'csv', 'excel', 'print'
        ]
    } );
} );
</script>



</head>
<body>

	<table id="example" class="display nowrap" style="width:100%">
        <thead>
            <tr>
                 <th>Employee ID</th>
                  <th>Name</th>
                  <th>Gross</th>
                  <th>Bonus</th>
                  <th>Absent </th>
                  <th>Net Amount</th>
                  <th>Date</th>
            </tr>
        </thead>
        <tbody>
           <?php
                    $sql = "SELECT * FROM salary";
                    $query = $conn->query($sql);
                    while($row = $query->fetch_assoc()){
                      echo "
                         <tr>
                          <td>".$row['employee_id']."</td>
                            <td>".$row['name']."</td>
                          <td>".$row['gross']."</td>
                            <td>".$row['bonus']."</td>
                              <td>".$row['absent']."</td>
                                <td>".$row['salary']."</td>
                          <td>".$row['dates']."</td>
                        </tr>
                      ";
                    }
                  ?>
           
        </tbody>
        
    </table>

</body>
</html>