生成Excel表格文件

489阅读 0评论2009-11-05 dongyue91
分类:

如下:

ob_start();
define("FILETYPE","xls");
header("Content-type:application/vnd.ms-excel");
if(FILETYPE=="xls")
    header("Content-Disposition:filename=report.xls");
else
    header("Content-Disposition:filename=report.csv");

echo "书名\t作者\t出版日期\t价格\n";
$chick_sql = $_GET["ss"];
#echo $chick_sql."
";

$chick_sql = str_replace("\'", "", $chick_sql);
$result = mysql_query($chick_sql,$con);
$num_rows = mysql_num_rows($result);
while($row = mysql_fetch_array($result)){
    echo "《".$row["bname"]."》\t".$row["booker"]."\t".$row["bookcbrq"]."\t¥".$row["bmoney"]."元\n";
}


从数据库提数据入表~~`
上一篇:刻板效应
下一篇:.htaccess 伪静态页