problem saving an excel file
am 09.09.2007 18:12:52 von GDi have a php script to convert a simple query into an excel format
file (tab delimited) which is called mysql-to-excel. on the author's
website when i click on the script i download an xls file, but when i
do the same on my server it just echos back the query without saving a
file. any ideas. here is the script:
include 'config.php';
include 'opendb.php';
$query = "SELECT * FROM information ORDER BY lastname";
$result = mysql_query($query) or die('Error, query failed');
$tsv = array();
$html = array();
while($row = mysql_fetch_array($result, MYSQL_NUM))
{
$tsv[] = implode("\t", $row);
$html[] = "
}
$tsv = implode("\r\n", $tsv);
$html = "
$fileName = 'mysql-to-excel.xls';
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$fileName");
echo $tsv;
//echo $html;
include 'closedb.php';
?>
thank you very much,
GD