File "generarExcel.php"

Full Path: C:/wamp64/www/sistemas/internet/generarExcel.php
File size: 669 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=redes_".date('Y-m-d').".xls");

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

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

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