<?php
include("../connection.php");
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=Baja_Activos_Fijos_".date('Y-m-d').".xls");
$con = connection();
$sql = "SELECT * FROM bajaActivos ORDER BY id DESC";
$query = $con->query($sql);
echo "<table border='1'>";
echo "<tr>
<th>ID</th>
<th>Fecha</th>
<th>Nombre</th>
<th>Cargo</th>
<th>tipo</th>
<th>Motivo</th>
<th>Equipo</th>
<th>referencia</th>
<th>Serial</th>
</tr>";
while ($row = $query->fetch_assoc()) {
echo "<tr>
<td>".$row['id']."</td>
<td>".htmlspecialchars($row['fecha'])."</td>
<td>".htmlspecialchars($row['nombre'])."</td>
<td>".htmlspecialchars($row['cargo'])."</td>
<td>".htmlspecialchars($row['tipo'])."</td>
<td>".htmlspecialchars($row['motivo'])."</td>
<td>".htmlspecialchars($row['equipo'])."</td>
<td>".htmlspecialchars($row['referencia'])."</td>
<td>".htmlspecialchars($row['serial'])."</td>
</tr>";
}
echo "</table>";
?>