0
我想将mysql表导出为pdf格式。请帮我将mysql数据导出为pdf文件
我试过这段代码。这里是我的代码
My.php
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("jass12", $con);
$result = mysql_query("SHOW COLUMNS FROM ja");
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result))
{
@$csv_output .='"'.$row['Field'].'","';
$i++;}
}
$csv_output .= "\n";
$values = mysql_query("SELECT * FROM ja");
while ($rowr = mysql_fetch_row($values)) {
for ($j=0;$j<$i;$j++) {
$csv_output .= $rowr[$j].",";
}
$csv_output .= "\n";
}
@$filename = $file."_".date("d-m-Y_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: xls" . date("Y-m-d") . ".xls");
header("Content-disposition: filename=".$filename.".xls");
print $csv_output;
exit;
?>
它产生错误&也给作为为XLS格式文件输出。
我想获得将数据库文件转换为pdf的确切编码。
使用FPDF http://www.fpdf.org/请帮我
看到这个链接http://www.ibm.com/developerworks/xml/library/x-buildpdfphp/index.html?ca=drs- –
你正在以xls格式创建的所有文件,然后这将如何生成pdf: ) –
你会提供给我的PDF确切的代码,我真的不知道。 – DaviJass