  | 
              
	              
	                
  
    
	 
        [HELP] ผมจะใช้ while loop 2-3 ชั้นใน PDF ควรทำอย่างไรครับ มันไม่เหมือนกับที่รัน HTML ?     | 
   
  
    |   | 
   
 
 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ต้องไล่ แท็กให้ดีๆ นะครับ 
 
html ตอนแสดงเป็น pdf ผิดนิดผิดหน่อย ไม่ได้เลยนะ  
 
แค่ลืม <td></td ใน html ธรรมดาแสดงผลนะ 
แต่ใน pdf ไม่แสดงเลยนะ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-12-21 10:57:35 | 
                        By :
                            Pong Thep | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ลองย้าย </tr> ให้อยู่ตาม loop ที่มันควรจะเป็นดูครับ 
 
Code (PHP) 
<table id="table-list" width="100%">
	<tr>
		<th><p>Item</p></th>
		<th><p>Model</p></th>
		<th><p>Imei</p></th>
		<th><p>Symptom</p></th>
		<th><p>Description</p></th>
		<th><p>Qty.</p></th>
		<th><p>Price(THB)</p></th>
		<th><p>Amount(THB)</p></th>
	</tr>
	<?php
	$i = 1;
	$sql_select = "SELECT qt_quotation_list.* FROM qt_quotation_list
	WHERE Quot_No = '".$rs['Quot_No']."'
	GROUP BY Qlist_Imei";
	$query_select = mysqli_query($conn, $sql_select);
	while($row = mysqli_fetch_array($query_select))
	{
		$sql_check ="SELECT qt_quotation_list.* FROM qt_quotation_list
		WHERE Quot_No = '".$rs['Quot_No']."' AND Qlist_Imei = '".$row['Qlist_Imei']."'";
		$query_check = mysqli_query($conn, $sql_check);
		$rowSpan= mysqli_num_rows($query_check);
	?>
		<tr class="text-center">
			<td rowspan="<?= $rowSpan?>" class="text-center" width="40px"><p><?= $i?></p></td>
			<td rowspan="<?= $rowSpan?>" class="text-center"><p><?= $row['Qlist_Model']?></p></td>
			<td rowspan="<?= $rowSpan?>" class="text-center"><p><?= $row['Qlist_Imei']?></p></td>
		<?php
		$sql_select2 = "SELECT * FROM qt_quotation_list
		WHERE Qlist_Imei = '".$row['Qlist_Imei']."' AND Quot_No = '".$rs['Quot_No']."'
		GROUP BY Qlist_Symptom";
		$query_select2 = mysqli_query($conn, $sql_select2);
		while($row = mysqli_fetch_array($query_select2))
		{
			$sql_check2 ="SELECT qt_quotation_list.* FROM qt_quotation_list
			WHERE Quot_No = '".$rs['Quot_No']."' AND Qlist_Imei = '".$row['Qlist_Imei']."' AND Qlist_Symptom = '".$row['Qlist_Symptom']."'";
			$query_check2 = mysqli_query($conn, $sql_check2);
			$rowSpan2= mysqli_num_rows($query_check2);
	?>
			<td rowspan="<?=$rowSpan2?>" class="text-left"><p><?= $row['Qlist_Symptom']?></p></td>
	<?php
			$sql_select3 = "SELECT * FROM qt_quotation_list
			WHERE Qlist_Symptom = '".$row['Qlist_Symptom']."' AND Quot_No = '".$rs['Quot_No']."' AND Qlist_Imei = '".$row['Qlist_Imei']."'";
			$query_select3 = mysqli_query($conn, $sql_select3);
			while($row = mysqli_fetch_array($query_select3))
			{
	?>
				<td class="text-left" min-width="300px"><p><?= $row['Qlist_Description']?></p></td>
				<td class="text-center" width="10px"><p><?= $row['Qlist_Qty']?></p></td>
				<td class="text-right" width="10px"><p><?= $row['Qlist_Price']?></p></td>
				<td class="text-right" width="10px"><p><?= $row['Qlist_Amount']?></p></td> 
	<?php
			}
		}
	?>
		</tr>
	<?php
		$i++;
	}
	?>
</table>
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-12-21 11:02:08 | 
                        By :
                            Jatmentz | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Update เหมือนกับเปลี่ยนปัญหาจากตรงนี้ แต่ไม่รู้จะทำให้มันอยู่ใน loop อย่างไง 
                         
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-12-21 11:59:30 | 
                        By :
                            instincthacker | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 แนะนำ ใส่เป็น table เข้าไปใน td ครับ อย่าทำ rowspan ไม่ work  
 
และถ้าจะทำ colspan ให้กำหนด width โดยตรง ให้เท่ากับ ขนาดของ 2 column 
 
Code (XML) 
<table border="1" bordercolor="white">
<tr><td width="50%" >w 50%</td><td width="25%">W 25</td><td width="25%"></tr>
<tr><td width="25%">w 25</td><td width="75%">
  <table border="0">
  <tr>
    <td width="50%" style="border-right: 1px solid white">w 50</td>
    <td width="25%" style="border-right: 1px solid white">W 25</td>
    <td width="25%" >W 25</tr>
  </table>
</td></tr>
</table>
 
 
ปล. แยกกัน PDF กับ HTML 
คล้ายกันแต่ไม่เหมือนกัน                        
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2018-12-21 13:07:03              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-12-21 13:02:14 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 border-left:  border-right: border-top: border-bottom: 
กำหนด เองเลยครับ ดูที่ตัวอย่างผมก็ลงให้ดูอะครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-12-21 14:52:42 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 $query_select2 = mysqli_query($conn, $sql_select2); 
$n1 = 1; 
while($row = mysqli_fetch_array($query_select2)) 
 
ตัวแปรสีแดงมันไปทับ ตัวแปร ข้างบน เปลี่ยนให้เป็น $row1 ซะ 
 
และควรจะ เก็บข้อมูล เป็น array ไว้ก่อน พอเปลี่ยนชุดที่ต่างกัน ค่อยเอาออกมา พิมพ์ 
 
ปล. มันมีคำสั่ง เลือน indicator ไปที่จุดเริ่มต้นใหม่ เพื่อที่จะได้ไม่ต้องคิวรี่ 2 ครั้ง 
http://php.net/manual/en/mysqli-result.data-seek.php                        
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2018-12-21 18:13:37 2018-12-21 18:19:44              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-12-21 18:11:27 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |