so I have this array
array (size=17)
'id' => string '21' (length=2)
'request_area' => string 'Area 1' (length=6)
'ship_product_code' => string '795919' (length=6)
'ship_product_description' => string 'BULBs' (length=5)
'qty' => string '2.0000' (length=6)
array (size=17)
'id' => string '22' (length=2)
'request_area' => string 'Area 1' (length=6)
'ship_product_code' => string '123' (length=3)
'ship_product_description' => string '321s' (length=4)
'qty' => string '3.0000' (length=6)
those arrays are inside
$product
I loop the product array and echo a table using following code
if(count($product)>0){
$i=0;
foreach($product as $v){
$i++;
$CONTENT.= '
<tr>
<td align="center" width="7%"> </td>
<td align="center" width="50%">'.$v['request_area'].'</td>
</tr>
<tr>
<td align="center" width="7%">'.$i.'</td>
<td align="center" width="50%">'.$v['ship_product_description'].'</td>
<td align="center" width="7%">'.number_format($v['qty']).'</td>
<td width="7%"> </td>
</tr>
';
}
}
The problem from above code is, it will create a tr with
Request Area
Item 1
Request Area
Item 2
What I want is, it prints the request area only once, and then followed by the Items. How can I achieve it?
Request Area //only once
Item 1
Item 2
Item 3
// and so on
Thank you :)