Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > การทำตารางข้อมูล แต่ output pdf ออกมาตารางมันมีแถวไม่ครบตามข้อมูลครับ



 

การทำตารางข้อมูล แต่ output pdf ออกมาตารางมันมีแถวไม่ครบตามข้อมูลครับ

 



Topic : 131981



โพสกระทู้ ( 30 )
บทความ ( 0 )



สถานะออฟไลน์




คือผมต้องการทำ pdf ตารางข้อมูลสินค้า 3 ชิ้น แต่พอ output ออกมามันมีตารางแค่แถวเดียว ผมใช้ mPDF

ภาพประกอบ

กหฟกหฟ



Code

Code (PHP)
$html ='<h2 align="center">Site Measurement Information</h2>';

			$html .='<h4>Project :'.$id_project.' </h4>';
			$html .='<h4>Quotation Number :'.$idquo.'  </h4>';

			


			$html .='<table style="border: 1px solid black;border-collapse: collapse;" align="center">';
		
			$html .='<thead>';
			


			$html .='<tr>';
				$html .='<th style="width: 20%; border: 1px solid black;border-collapse: collapse;" >รหัส Code</th>';
				$html .='<th style="width: 20%; border: 1px solid black;border-collapse: collapse;">รายละเอียดสินค้า Description</th>';
				$html .='<th style="width: 35%; border: 1px solid black;border-collapse: collapse;">ความกว้าง Width(mm.)</th>';
				$html .='<th style="width: 35%; border: 1px solid black;border-collapse: collapse;">ความสูง Height(mm.)</th>';
				$html .='<th style="width: 35%; border: 1px solid black;border-collapse: collapse;">จำนวน Quantity</th>';
			$html .='</tr>';
			


			$html .=' </thead>';


			
			$item = $this->m_site_measurement->get_info_measurement();
  				foreach ($item as $sitem_r){

  					$iditem = $sitem_r->f_id_quotation_item;
  					$idsite_measurement = $sitem_r->id_site_measurement;

			$html .='<tbody>';

			$html .='<tr>';
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$sitem_r->item_name_sm.'</td>';			

			$w = explode("/", $sitem_r->exact_width_mm);
									$count_w = count($w);
			
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$sitem_r->item_description.'</td>';
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$w[($count_w-1)].'</td>';


			$h = explode("/", $sitem_r->exact_height_mm);
									$count_h = count($h);
								

				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$h[($count_h-1)].'</td>';
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$sitem_r->item_quantity.'</td>';
			$html .='</tr>';

			$html .='</tbody>';
			$html .='</table>';
			

			}	

			$filename = 'site_infomation_'.$idquo.'.pdf';
						
						$files = glob('uploads/site_infomation/*'); // get all file names (ARRAY)
						$count = count($files);
						
						for($i=0;$i<$count;$i++)
						{
							if($files[$i] == 'uploads/site_infomation/'.$filename)
							{
								unlink($files[$i]);// delete file
							}
						}
						
						
						$this->mpdf = new mPDF('th','A4');//
						//$this->mpdf = new mPDF('th','A3');
						$this->mpdf->debug = true;
						//$this->mpdf->SetDisplayMode('fullpage'); 
						$this->mpdf->WriteHTML($html);
						$this->mpdf->Output('uploads/site_infomation/'.$filename);


ช่วยดูว่าผมเขียนถูกไหมครับ หรือผมต้องแก้ไข เพิ่มเติมตรงไหนครับ



Tag : PHP, HTML5, PDF







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2018-09-06 08:36:52 By : simson_palo View : 1809 Reply : 2
 

 

No. 1



โพสกระทู้ ( 421 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ลองดูนะครับ
https://www.thaicreate.com/php/php-pdf-mysql-export-pdf.html






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2018-09-06 08:43:56 By : nobetaking
 


 

No. 2



โพสกระทู้ ( 157 )
บทความ ( 0 )



สถานะออฟไลน์


จาก
foreach ($item as $sitem_r){

  					$iditem = $sitem_r->f_id_quotation_item;
  					$idsite_measurement = $sitem_r->id_site_measurement;

			$html .='<tbody>';

			$html .='<tr>';
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$sitem_r->item_name_sm.'</td>';			

			$w = explode("/", $sitem_r->exact_width_mm);
									$count_w = count($w);
			
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$sitem_r->item_description.'</td>';
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$w[($count_w-1)].'</td>';


			$h = explode("/", $sitem_r->exact_height_mm);
									$count_h = count($h);
								

				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$h[($count_h-1)].'</td>';
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$sitem_r->item_quantity.'</td>';
			$html .='</tr>';

			$html .='</tbody>';
			$html .='</table>';
			

			}	


เป็น
$html .='<tbody>';
foreach ($item as $sitem_r){

  					$iditem = $sitem_r->f_id_quotation_item;
  					$idsite_measurement = $sitem_r->id_site_measurement;

			$html .='<tr>';
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$sitem_r->item_name_sm.'</td>';			

			$w = explode("/", $sitem_r->exact_width_mm);
									$count_w = count($w);
			
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$sitem_r->item_description.'</td>';
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$w[($count_w-1)].'</td>';


			$h = explode("/", $sitem_r->exact_height_mm);
									$count_h = count($h);
								

				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$h[($count_h-1)].'</td>';
				$html .='<td align="center" style="width: 35%; border: 1px solid black;border-collapse: collapse;">&nbsp;&nbsp;'.$sitem_r->item_quantity.'</td>';
			$html .='</tr>';
			

			}	

			$html .='</tbody>';
			$html .='</table>';

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2018-09-06 09:26:37 By : Jatmentz
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : การทำตารางข้อมูล แต่ output pdf ออกมาตารางมันมีแถวไม่ครบตามข้อมูลครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่