เขียน PHP สร้งไฟล์ PDF แล้ว error ช่วยแนะนำทีค่ะ

เริ่มโดย utchara, 29 ตุลาคม 2013, 10:02:17

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

utchara

<?php

define('FPDF_FONTPATH','font_pdf/');
require('fpdf/fpdf.php');
include("idna_convert.class.php");
include ("inc_dbconnect.php");
class PDF extends FPDF
{

function Footer()
{      
   //footer
   $this->SetFont('CordiaNew','',12);
   $this->SetTextColor(0);
   $this->SetY(-15);
   $this->Cell(0,10,'ถนนรัชดาภิเษก ',0,1,'C');
   $this->Cell(0,0,'แขวงห้วยขวาง เขตห้วยขวาง กทม. 10310',0,0,'C');
   
}


function LoadData($file)
{
   //Read file lines
   $lines=file($file);
   $data=array();
   foreach($lines as $line)
      $data[]=explode(';',chop($line));
   return $data;
}

function BasicTable($header,$data)
{
   //Header
   $w=array(30,30,55,25,20,20,20);
   //Header
   for($i=0;$i<count($header);$i++)
      $this->Cell($w[$i],7,$header[$i],1,0,'C');
   $this->Ln();
   //Data
   foreach ($data as $eachResult)
   {
      $this->Cell(30,6,$eachResult["keywords_id"],1);
      $this->Cell(30,6,$eachResult["prop_id"],1);
      $this->Cell(55,6,$eachResult["keywords_topic"],1);
      $this->Cell(25,6,$eachResult["keywords_find"],1,0,'C');
      $this->Cell(20,6,$eachResult["keywords_cpc"],1);
      $this->Cell(20,6,$eachResult["keywords_remark"],1);
      $this->Cell(20,6,$eachResult["lastUpdate"],1);                   
      $this->Ln();
   }
}



}//end class


      $pdf = new PDF();
      $pdf->AddPage();
      $pdf->Remaining_Budget();   
      
      $header=array('keywords_id','prop_id','keywords_topic','keywords_find','keywords_cpc','keywords_remark','lastUpdate');
      //Data loading
      
      //*** Load MySQL Data ***//
      $strSQL = "SELECT * FROM keywords where prop_id='7' ";
      $objQuery = mysql_query($strSQL, $dbname);
      $resultData = array();
         
      for ($i=0;$i<mysql_num_rows($objQuery);$i++) {
         $result = mysql_fetch_array($objQuery);
         array_push($resultData,$result);
      }
      
      
      $pdf->SetFont('Arial','',10);

      //*** Table 1 ***//
      $pdf->AddPage();
      $pdf->Ln(35);
      $pdf->SetFont('CordiaNew','',14);
      $pdf->BasicTable($header,$resultData);

      
      
      $path = "/home/keyword";
      $filename = "example_report.pdf";      
      $path_file = $path."/".$filename;

      $pdf->Output('$path_file', 'I');
   

?>


หน้าต่างแสดง error
FPDF error: Some data has already been output, can't send PDF file

ช่วยแนะนำด้วยนะคะ ขอบคุณค่ะ :P
ขายน้ำมันดีเซลราคาถูก, ขายน้ำมัน, บริการน้ำมันถึงที่, น้ำมันราคาถูก
http://www.xn--22c0ca5ad6gdc0snb.com

smapan

[direct=http://cp.siamhostweb.com/cart.php?gid=1]จูมล่าโฮส สยามโฮสเว็บ[/direct] [direct=http://www.modty.com]modty.com[/direct]
[direct=http://www.apartment.in.th]รวมที่พัก เช่ารายวัน ที่พักเช่ารายเดือนมากที่สุดแจ่มจริง[/direct]
***Tel 083-757-1515 ติดปัญหา Joomla ตรงไหนรับปรึกษาฟรี โทรมาเถอะครับ ถ้าตอบได้ช่วยแน่นอน ไม่มีกั้ก. ***

adidog

ไม่เคยใช้ FPDF ใช้แต่ TCPDF ลองดูพวก encode ของไฟล์ครับ
Certain Dri [direct=http://www.ishiclub.com/]Certain Dri[/direct]
คุณแม่มือใหม่ [direct=http://www.mamyget.com/]คุณแม่มือใหม่[/direct]