hei friends
am trying to display a report generation in a pdf file using the php. how can i retrieve the database values in the pdf file..??
now am using this code
<?php
define('FPDF_FONTPATH','Template/includes/font/');
require('Template/includes/fpdf.php');
include('Template/includes/common.inc.php');
class PDF extends FPDF
{
//Load data
function LoadData($classID)
{
//Read data from table
$ResultAllClass=QrySelect("SELECT distinct new_sm_examid_issue.exam_id,sm_studentmaster.stu_id ,sm_studentmaster.stu_name, sm_studentmaster.stu_dob,sm_studentmaster.stu_state,sm_studentmaster.stu_country,sm_studentmaster.stu_residentphone
from sm_studentmaster,new_sm_examid_issue
WHERE sm_studentmaster.stu_id=new_sm_examid_issue.stu_id and sm_studentmaster.cls_id=new_sm_examid_issue.cls_id and sm_studentmaster.cls_id='$classID' ");
$datas=array();
while($class=mysql_fetch_row($ResultAllClass))
{
$datas[]=$class;
}
mysql_free_result($ResultAllClass);
return $datas;
}
//Simple table
function BasicTable($header,$data)
{
//Header
foreach($header as $col)
{
$this->Cell(28,7,$col,1);
}
$this->Ln();
//Data
foreach($data as $row)
{
$this->Cell(28,7,$row,1);
$this->Ln();
}
}
}
$pdf=new PDF();
// Row data
$vals = $_GET['test'];
echo $vals;
$data=$pdf->LoadData($vals);
$pdf->SetFont('Arial','B',10);
$pdf->AddPage();
//Column titles
$header=array('ExamId','StudentId','StudentName','DOB','State','Country','Phone Number');
$pdf->BasicTable($header,$data);
$pdf->Output();
?>
this is not working produce one error message
938 //Send to standard output
939 if (isset($HTTP_SERVER_VARS['SERVER_NAME'])) {
940 //We send to a browser
941 Header('Content-Type: application/pdf');
942 if (headers_sent())
943 $this->Error('Some data has already been output to browser, can\'t send PDF file');
944 Header('Content-Length: '.strlen($this->buffer));
WARNING: Cannot modify header information - headers already sent by (output started at C:\wamp\www\temp\Vishnu\School Management Project\Template\includes\common.inc.php:27)
File: C:\wamp\www\temp\Vishnu\School Management Project\Template\includes\fpdf.php
FPDF error: Some data has already been output to browser, can't send PDF file
then i checked the common.inc.php
there is no blank space before and after <? ?>
please anyone help me.