0

As I don't know how many column for table
So I only can write a stupid script when the value is not null. Then show the value
Does anyone have a good idea for write a simple script to implement this request.

foreach ($pl_width_arr as $pl_width_arr[$pl]){
	   
	  		if ($pl_width_arr[$pl]['family_code'] == $family_code_eng)
			{
			  	$mpdf->WriteHTML('<tr><td bgcolor="'.$bgcolor.'"><span class="style_table_content">'.$pl_width_arr[$pl][$field_1_eng].'</span></td><td bgcolor="'.$bgcolor.'" align="center">');
				
				if ($field_2_eng <> "")
					{ 
						$substr_field_2_eng = substr($pl_width_arr[$pl][$field_2_eng], 0 , 1);
						if ($substr_field_2_eng <> '~')
						{
						$mpdf->WriteHTML('<span class="style_table_content">'.$pl_width_arr[$pl][$field_2_eng].'</span></td>');
						}
						else
						{
						$mpdf->WriteHTML('~</td>');
						}
					}	

	
	
				if ($field_3_eng <> "")
					{ 
						$substr_field_3_eng = substr($pl_width_arr[$pl][$field_3_eng], 0 , 1);
						if ($substr_field_3_eng <> '~')
						{
						$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center"><span class="style_table_content">'.$pl_width_arr[$pl][$field_3_eng].'</span></td>');
						}
						else
						{$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center">~</td>');
						}
					}	
				if ($field_4_eng <> "")
					{ 
						$substr_field_4_eng = substr($pl_width_arr[$pl][$field_4_eng], 0 , 1);
						if ($substr_field_4_eng <> '~')
						{
						$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center"><span class="style_table_content">'.$pl_width_arr[$pl][$field_4_eng].'</span></td>');
						}
						else
						{$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center">~</td>');
						}
					}	
				if ($field_5_eng <> "")
					{ 
						$substr_field_5_eng = substr($pl_width_arr[$pl][$field_5_eng], 0 , 1);
						if ($substr_field_5_eng <> '~')
						{
						$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center"><span class="style_table_content">'.$pl_width_arr[$pl][$field_5_eng].'</span></td>');
						}
						else
						{$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center">~</td>');
						}
					}	
				if ($field_6_eng <> "")
				    {
					$substr_field_6_eng = substr($pl_width_arr[$pl][$field_6_eng], 0 , 1);
						if ($substr_field_6_eng <> '~')
						{
						$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center"><span class="style_table_content">'.$pl_width_arr[$pl][$field_6_eng].'</span></td>');
						}
						else
						{$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center">~</td>');
						}
					}
				if ($field_7_eng <> "")
					{ 
						$substr_field_7_eng = substr($pl_width_arr[$pl][$field_7_eng], 0 , 1);
						if ($substr_field_7_eng <> '~')
						{
						$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center"><span class="style_table_content">'.$pl_width_arr[$pl][$field_7_eng].'</span></td>');
						}
						else
						{$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center">~</td>');
						}
					}	
				if ($field_8_eng <> "")
					{ 
						$substr_field_8_eng = substr($pl_width_arr[$pl][$field_8_eng], 0 , 1);
						if ($substr_field_8_eng <> '~')
						{
						$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center"><span class="style_table_content">'.$pl_width_arr[$pl][$field_8_eng].'</span></td>');
						}
						else
						{$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center">~</td>');
						}
					}	
				if ($field_9_eng <> "")
					{ 
						$substr_field_9_eng = substr($pl_width_arr[$pl][$field_9_eng], 0 , 1);
						if ($substr_field_9_eng <> '~')
						{
						$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center"><span class="style_table_content">'.$pl_width_arr[$pl][$field_9_eng].'</span></td>');
						}
						else
						{$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center">~</td>');
						}
					}	
				if ($field_10_eng <> "")
					{ 
						$substr_field_10_eng = substr($pl_width_arr[$pl][$field_10_eng], 0 , 1);
						if ($substr_field_10_eng <> '~')
						{
						$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center"><span class="style_table_content">'.$pl_width_arr[$pl][$field_10_eng].'</span></td>');
						}
						else
						{$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center">~</td>');
						}
					}	
				if ($field_11_eng <> "")
					{ 
						$substr_field_11_eng = substr($pl_width_arr[$pl][$field_11_eng], 0 , 1);
						if ($substr_field_11_eng <> '~')
						{
						$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center"><span class="style_table_content">'.$pl_width_arr[$pl][$field_11_eng].'</span></td>');
						}
						else
						{$mpdf->WriteHTML('<td bgcolor="'.$bgcolor.'" align="center">~</td>');
						}
					}	
				$mpdf->WriteHTML('</tr>');
				$token = 0;
				$pre_fam_id = $pl_width_arr[$pl]['family_id'];
			}
		}
3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by diafol
0

a. What is it you are trying to do?

b. Please reduce the number of tabs in your code and repost the code.

c. Thanks.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.