|
![](/images/resource/spacer.gif) |
|
ผมอยากสร้างรายงานข้อมูลจาก โปรเจ็คเดียวกันแต่แบ่งออกเป็นสองชุดผมเขียนคำสั่งถูกไหมครับ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ต้องเพิ่ม group by 2 คอลัมน์นี้ ใน query ด้วยรึเปล่าครับ ลองตรวจสอบดูครับ
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2018-09-15 12:19:14 |
By :
chayayol |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
คร่าวๆ
Code (SQL)
SELECT // ข้อมูลที่ต้องการ
FROM // จาก Table?
WHERE // เงื่อนไข
GROUP BY // รวมกลุ่มให้ข้อมูล
ORDER BY // เรียงลำดับข้อมูล
Code (PHP)
$data; // ข้อมูลที่ได้จาก database
$tmp_quo = '';
$html = '';
foreach($data as $key => $value){
if($tmp_quo != $value[/*f_id_quo*/] && $key != 0){
$this->mpdf = new mPDF('th','A4');
$this->mpdf->debug = true;
$this->mpdf->WriteHTML($html);
$this->mpdf->Output('uploads/site_infomation/'.$filename); // ตรง Output ถ้าถูกเรียก Header น่าจะทำให้ code หยุดทำงาน
$html = '';
}
$html; // กำหนดข้อมูล html
if($key+1 == sizeof($data)){
$this->mpdf = new mPDF('th','A4');
$this->mpdf->debug = true;
$this->mpdf->WriteHTML($html);
$this->mpdf->Output('uploads/site_infomation/'.$filename); // ตรง Output ถ้าถูกเรียก Header น่าจะทำให้ code หยุดทำงาน
}
}
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2018-09-15 14:08:53 |
By :
Jatmentz |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 05
|