File "ExcelColaboradores.php"

Full Path: C:/wamp64/www/porteria/colaboradores/ExcelColaboradores.php
File size: 1.22 KB
MIME-type: text/x-php
Charset: utf-8

<?php
include("../connection.php");
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=Permisos_Colaboradores".date('Y-m-d').".xls");

$con = connection();
$sql = "SELECT * FROM permisos ORDER BY id DESC";
$query = $con->query($sql);

echo "<table border='1'>";
echo "<tr>
        <th>ID</th>
        <th>fecha</th>
		<th>hora</th>
        <th>Nombre</th>
        <th>cedula</th>
        <th>centro_costos</th>
		<th>arl</th>
		<th>eps</th>
		<th>telefono</th>
		<th>rh</th>
		<th>motivo</th>
      </tr>";

while ($row = $query->fetch_assoc()) {
    echo "<tr>
            <td>".$row['id']."</td>
            <td>".htmlspecialchars($row['fecha'])."</td>
            <td>".htmlspecialchars($row['hora'])."</td>
			<td>".htmlspecialchars($row['nombre'])."</td>
            <td>".htmlspecialchars($row['cedula'])."</td>
            <td>".htmlspecialchars($row['centro_costos'])."</td>
			<td>".htmlspecialchars($row['arl'])."</td>
			<td>".htmlspecialchars($row['eps'])."</td>
			<td>".htmlspecialchars($row['telefono'])."</td>
			<td>".htmlspecialchars($row['rh'])."</td>
			<td>".htmlspecialchars($row['motivo'])."</td>
          </tr>";
}
echo "</table>";
?>