Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\test2\config.inc.php:11) in C:\AppServ\www\test2\fpdf.php on line 1017
FPDF error: Some data has already been output, can't send PDF file
ตัวไฟล์
<?php require('fpdf.php');
class PDF extends FPDF
{
//Colored table
function ManyPageTable($header,$data)
{
//Colors, line width and bold font
$this->SetFillColor(255,0,0);
$this->SetTextColor(255);
$this->SetDrawColor(128,0,0);
$this->SetLineWidth(.3);
$this->SetFont('angsa','',12);
//Header
$w=array(18,37,27,28,37,8,20,20);
for($i=0;$i<count($header);$i++)
$this->Cell($w[$i],6,iconv('UTF-8','CP874',$header[$i]),1,0,'C',true);
$this->Ln();
//Color and font restoration
$this->SetFillColor(224,235,255);
$this->SetTextColor(0);
$this->SetFont('angsa','',10);
//Data
$fill=false;
foreach($data as $row)
{
$this->SetX(20);
$this->Cell(154,8,$row["EDUCATIONID"]);
$this->Cell(35,8,$row["PREFIX_NAME"],'1',0,'C');
$this->Cell(35,8,$row["APPLICANT_FNAME"],'1',0,'C');
$this->Cell(35,8,$row["APPLICANT_LNAME"],'1',0,'C');
$this->Cell(35,8,$row["TEAMWORK_EDUCATION"],'1',0,'C');
$this->Cell(35,8,$row["TEAMWORK_NAME"],'1',0,'C');
$this->Cell(35,8,$row["PROJECT_NAME"],'1',0,'C');
$this->Cell(35,8,$row["LEVEL_NAME"],'1',0,'C');
$this->Ln();
$fill=!$fill;
}
$this->Cell(array_sum($w),0,'','T');
}///close for
}///close function
include("config.inc.php");
$CONTEST_CODE=$_GET[CONTEST_CODE];
$pdf=new PDF('P','mm','A4');
$header=array('รหัสนักศึกษา','ชื่อ-นามสกุล','โรงเรียน','ชื่อทีม','โครงการที่เข้าร่วม','ระดับ');
$pdf->AddFont('angsa','','angsa.php');
$perpage=36;
$strSQL1 = "SELECT * FROM teamwork where CONTEST_CODE=$CONTEST_CODE";
$objQuery1= mysql_query($strSQL1, $conn);
$numall=mysql_num_rows($objQuery1);
$allpage=ceil($numall/$perpage);
if(empty($goto)){$goto=0;};
for($i=0;$i<$allpage;$i++){
$strSQL = "SELECT applicant.EDUCATIONID, perfix.PREFIX_NAME, applicant.APPLICANT_FNAME, applicant.APPLICANT_LNAME, teamwork.TEAMWORK_EDUCATION, teamwork.TEAMWORK_NAME, project.PROJECT_NAME, project_level.LEVEL_NAME, project_contest.CONTEST_CODE
FROM ((((project INNER JOIN project_contest ON project.PROJECT_CODE = project_contest.PROJECT_CODE) INNER JOIN teamwork ON project_contest.CONTEST_CODE = teamwork.CONTEST_CODE) INNER JOIN applicant ON teamwork.TEAMWORK_CODE = applicant.TEAMWORK_CODE) INNER JOIN perfix ON applicant.PREFIX_CODE = perfix.PREFIX_CODE) INNER JOIN project_level ON project_contest.LEVEL_CODE = project_level.LEVEL_CODE
WHERE (((project_contest.CONTEST_CODE)=$CONTEST_CODE)) limit $goto,$perpage";
$objQuery= mysql_query($strSQL, $conn);
$resultData = array();
for ($i=0;$i<mysql_num_rows($objQuery);$i++) {
$result = mysql_fetch_array($objQuery);
array_push($resultData,$result);
}
$pdf->AddPage();
$pdf->SetFont('angsa','',18);
$pdf->Cell('200','6',iconv('UTF-8','CP874','รายชื่อนักศึกษา),0,1,'C');
$pdf->SetFont('angsa','',14);
$pdf->Ln();
//$pdf->ManyPageTable($header,$resultData);
$goto = $goto+$perpage;
}///close for