Originariamente inviato da stuartmcr
ho fatto la modifica:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang=it><head>
<title>Titolo</title></head>
<body>
<?php
$hostname = "localhost";
$database = "portaletreni";
$username = "root";
$password= "testpass";
$conn= mysql_pconnect($hostname, $username, $password) or die(mysql_error());
mysql_select_db($database, $conn);
$query = "SELECT id_treno, luogo, note FROM treni";
$clienti = mysql_query($query, $conn) or die(mysql_error());
$row_clienti = mysql_fetch_assoc($clienti);
?>

<?php
do {
$righe.= "\"".$row_clienti['id_treno']."\"\t\"".$row_clienti['luogo']."\"\t\"".$row_clienti['note']."\"\n";
} while ($row_clienti= mysql_fetch_assoc($clienti));
?>

<?php
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: nomefile.xls");
?>

<?php
print $righe;
exit;
?>


</body></html>

ora però non apre + il xls ma ho gli stessi warning; che mi consigli?
Devi spostare in alto le righe di header prima di <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ...