I have no issue in getting my data to download into MySQL, but can you
A) Style the info? So like make a certain font and size?
B) It isn't displaying my table column names as the heading any clues?
This is what I have
PHP Code:<?php
include 'library/config.php';
include 'library/opendb.php';
$query = "SELECT * FROM tbl WHERE `Member`='A'";
$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[] = "<tr><td>" .implode("</td><td>", $row) . "</td></tr>";
}
$tsv = implode("\r\n", $tsv);
$html = "<table>" . implode("\r\n", $html) . "</table>";
$fileName = 'mysql-to-excel.xls';
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$fileName");
echo $tsv;
//echo $html;
include 'library/closedb.php';
?>



Reply With Quote

Bookmarks