 |
|
FPDF ต้องการแสดงข้อมูล fetch array เป็น 2 column ซ้าย ขวา ใช้ while loop แล้วมันแสดงข้อมูลไม่ครบ ถูกตัดไปเท่ากับแถวด้านขวา
Code (PHP)
ตามรูปเลยครับ

โค้ด
function viewTable($db){
$this->AddFont("THSarabunNew","","THSarabunNew.php");
$this->SetFont("THSarabunNew_B","",10);
$stmt = $db->query('select * from employee where work = "หัวหน้าส่วน" or work = "สารบรรณ" or work = "ขนส่งทั่วไป" and position <> "ลูกจ้างเหมา"');
$stmt2 = $db->query('select * from employee where work = "ขนส่งวัสดุครุภัณฑ์" or position = "ลูกจ้างเหมา" or work = "-"');
while($data = $stmt->fetch(PDO::FETCH_OBJ) and $data2 = $stmt2->fetch(PDO::FETCH_OBJ)){
$this->Cell(14,5.1,iconv('UTF-8', 'TIS-620', $data->number),1,0,C);
$this->Cell(19,5.1,iconv('UTF-8', 'TIS-620', $data->first_name),LB,0,C);
$this->Cell(19,5.1,iconv('UTF-8', 'TIS-620', $data->last_name),RB,0,C);
$this->Cell(13,5.1,iconv('UTF-8', 'TIS-620', $data->position),1,0,C);
$this->Cell(15,5.1,iconv('UTF-8', 'TIS-620', ''),1,0,C);
$this->Cell(15,5.1,iconv('UTF-8', 'TIS-620', $data->job),1,0,C);
$this->Cell(14,5.1,iconv('UTF-8', 'TIS-620', $data2->number),1,0,C);
$this->Cell(19,5.1,iconv('UTF-8', 'TIS-620', $data2->first_name),LB,0,C);
$this->Cell(19,5.1,iconv('UTF-8', 'TIS-620', $data2->last_name),RB,0,C);
$this->Cell(13,5.1,iconv('UTF-8', 'TIS-620', $data2->position),1,0,C);
$this->Cell(15,5.1,iconv('UTF-8', 'TIS-620', ''),1,0,C);
$this->Cell(15,5.1,iconv('UTF-8', 'TIS-620', $data2->job),1,1,C);
}
}
Tag : PHP

|
ประวัติการแก้ไข 2021-08-06 01:05:33
|
 |
 |
 |
 |
Date :
2021-08-06 01:04:21 |
By :
boomdaba |
View :
849 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |