File "generarExcel.php.bak"

Full Path: C:/wamp64/www/sistemas/correosCelular/generarExcel.php.bak
File size: 831 bytes
MIME-type: text/x-php
Charset: utf-8

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

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

echo "<table border='1'>";
echo "<tr>
        <th>ID</th>
        <th>Cargo</th>
        <th>Nombre</th>
        <th>Correo</th>
        <th>ContraseƱa</th>
      </tr>";

while ($row = $query->fetch_assoc()) {
    echo "<tr>
            <td>".$row['id']."</td>
            <td>".htmlspecialchars($row['cargo'])."</td>
            <td>".htmlspecialchars($row['nombre'])."</td>
            <td>".htmlspecialchars($row['correo'])."</td>
            <td>".htmlspecialchars($row['contrasena'])."</td>
          </tr>";
}
echo "</table>";
?>