ทำรายงาน ออกเป็นแบบ pdf อะครับแล้ว ข้อมูลจาก DB ไม่ยอมออกช่วยที่

ทำรายงาน ออกเป็นแบบ pdf อะครับแล้ว ข้อมูลจาก DB ไม่ยอมออกช่วยที่นะครับ

$id=1;

  $sql55= "SELECT * FROM empbyess  where  id_emp = '$id' "; // SELECT ต่างๆๆ

  $ans = mysql_db_query($myselect_db,$sql55); 

  $result1 = mysql_fetch_array($ans);



function BasicTable($header,$data){



    $this->AddFont('angsa','','angsa.php');

    $this->AddFont('angsa','B','angsa.php');

    $this->SetFont('angsa','',12);

    $this->Rect(10, 26, 190, 8, 'D');



   $this->Cell( 0,7,iconv('TIS-620','cp874','ตำแหน่งที่สมัคร 1.      ' .$result1['position1'].' ), 0 , 1 , 'L' ); // << แบบนี้มันไม่ยอม ออกฐานข้อมูล

}



 $pdf->Cell( 0,7,'ตำแหน่งที่สมัคร 1.      ' .$result1[position1] ,0,1,'L'); // ข้อมูบใน DB ออกอะคับ





คือเปลี่ยนจาก $this เป็น $pdf และไม่อยู่ใน function ข้อมูลออกหมดครับไม่ต้องใส่ iconv() ก็ออกเป็นภาษาไทยปกติ



20 ธ.ค. 2555 4 3,972

555++



$this จะหมายถึงตัวฟังก์ชั่นครับ



ให้ทำการส่งค่า clas pdf เข้าไปด้วย



function BasicTable($pdf, $header,$data){

    $pdf->.....

}
#1

โอ้ยๆๆๆ ขอบคุณมากๆๆๆๆคับบบบบบบบบบบบบบ ^^ มันออกแล้วอยากจะ กริ๊ด นั่งหามาทั้งวัน
#2

ทำรายงาน ออกเป็นแบบ pdf อะครับแล้ว ข้อมูลจาก DB ไม่ยอมออกช่วยที่
รับกวนต่อหน่อยนะคับ ^^ ยังไม่เสร็จง่ายๆๆอะคับ



คือ จะให้มัน fetch_array เป็นสองตาราง ทำ function FancyTable1 กับ function FancyTable2 แยกกัน ดดนที่ชุดคำสั่งเหมือนกันเปลี่ยนค่าชื่อตัวแปร

ผลคือ ตารางมันออกมาติดกันเลยอะคับ จาให้ $pdf->Ln(); ตรงไหนอ่าคับมันถึงจาแยกออกจากกันคับ    รบกวนหน่อยนะคับบบบ

function FancyTable($header,$data)

{

    //Colors, line width and bold font

    $this->SetFillColor(99,184,255);

    $this->SetTextColor(255);

    $this->SetDrawColor(92,172,238);

    $this->SetLineWidth(.3);

    $this->AddFont('angsa','','angsa.php');

    $this->AddFont('angsa','B','angsa.php');

    $this->SetFont('angsa','',12);

    //Header

    $w=array(50,20,100,20);

    for($i=0;$i<count($header);$i++)

        $this->Cell($w[$i],7,$header[$i],1,0,'C',true);

    $this->Ln();

    //Color and font restoration

    $this->SetFillColor(224,235,255);

    $this->SetTextColor(0);

    $this->SetFont('');

    //Data

    $fill=false;                                               

    foreach($data as $row)

    {

        $this->Cell($w[0],6,$row[0],'LR',0,'L',$fill);

        $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill);

        $this->Cell($w[2],6,$row[2],'LR',0,'L',$fill);

        $this->Cell($w[3],6,$row[3],'LR',0,'C',$fill);

        $this->Ln();

        $fill=!$fill;

    }

    $this->Cell(array_sum($w),0,'','T');

}

}



 
#3

55+++ จะรู้ไหมนั้น



ง่ายนิดเดียวครับ ก็เขียนคำสั่งแยกกันสองชุดตามเงื่อนไขที่ต้องการไปเลยครับ
#4
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^