io ho fatto così:
faccio la query poi
Codice PHP:
<?php
$nomefile = "nomefileproposto.xls";
header ("Content-Type: application/vnd.ms-excel");
header ("Content-Disposition: inline; filename=$nomefile");
?>
poi la tabella..
Codice PHP:
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>campo 1</td>
<td>campo 2</td>
<td>campo 3</td>
<td>campo 4</td>
</tr>
//qua il ciclo dei tuoi dati
<?php do { ?>
<tr>
<td><?php echo $var1; ?></td>
<td><?php echo $var2; ?></td>
<td><?php echo $var3; ?></td>
<td><?php echo $var4; ?></td>
</tr>
// qua chiudi il ciclo