 |
รบกวนด้วยค่าสร้างรายงานเป็น pdf แล้ว error "FPDF error: Some data has already been output, can't send PDF file" |
|
 |
|
|
 |
 |
|
เขียนโปรแกรมออกรายงานเป็น pdf แล้ว error FPDF error: Some data has already been output, can't send PDF file
ตาม code นี้ค่า
Code (PHP)
<?php
include('fpdf.php');
include("conf/ConnectDb.php");
class PDF extends FPDF {
//Simple table
function BasicTable($header,$data)
{
//Header
foreach($header as $col)
$this->Cell(40,7,$col,1);
$this->Ln();
//Data
$cnt1 = 0;
while($cnt1 < count($data)) {
$cnt2 = 0;
while($cnt2 < count($data[$cnt1])) {
$this->Cell(40,6,$data[$cnt1][$cnt2],1);
$cnt2++;
}
$this->Ln();
$cnt1++;
}
}
}//end class
//header declare
$header=array('Id','Level');
//data query from database keep to array 2 dimension
$sql = "Select IdOwner,LevelAudit From Audit";
$query = mssql_query($sql);
$i=0;
while ($rss=mssql_fetch_array($query)) {
$data[$i][0] = $rss['IdOwner'];
$data[$i][1] = $rss['LevelAudit'];
$i++;
}
//create object pdf
$pdf = new PDF();
$pdf->SetFont('Arial','',14);
$pdf->AddPage();
$pdf->BasicTable($header,$data);
$pdf->Output();
?>
Tag : PHP, Report Others
|
|
 |
 |
 |
 |
Date :
2010-08-17 14:20:12 |
By :
nitnit_noinoi |
View :
1610 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันบอกว่าไฟล์ pdf ที่สร้างมีอยู่แล้วน่ะครับ จะต้องลบทิ้งก้อนน่ะครับ
|
 |
 |
 |
 |
Date :
2010-08-17 17:44:07 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|