Ciao. Questo è un esempio didattico di come si crea un file excel tramite php.
Non devi quindi fare altro che che adattarlo nello specifico alla tua query.Codice PHP:
<?php
header ("Content-Type: application/vnd.ms-excel");
header ("Content-Disposition: inline; filename=\"tabella.xls\" ");
echo "<table>";
for ($i=1;$i < 11; $i++)
{
echo "<tr>";
for ($j=1; $j<11;$j++)
{
$a = $i * $j;
echo "<td>$a</td>";
}
echo "</tr>";
}
echo "</table>";
?>![]()