-2
I’m having difficulty making foreach with array, being 2 columns with rowspan and other 2 columns showing array of products of each furnace. See the example below of how it should be.
<table class="table" border="1" style="width:100%">
<thead>
<tr>
<th>Codigo</th>
<th>Fornecedor</th>
<th>Produto</th>
<th>Valor</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="3">1</td>
<td rowspan="3">Representante 1</td>
<td>bolsa 1</td>
<td>8,89</td>
</tr>
<tr>
<td>bolsa 2</td>
<td>4,36</td>
</tr>
<tr>
<td>bolsa 3</td>
<td>5,89</td>
</tr>
<tr>
<td rowspan="3">2</td>
<td rowspan="3">Representante 2</td>
<td>bolsa 1</td>
<td>1,99</td>
</tr>
<tr>
<td>bolsa 2</td>
<td>1,49</td>
</tr>
<tr>
<td>bolsa 3</td>
<td>2,99</td>
</tr>
</tbody>
</table>
The received array is this!
$array = array(
array(
'codigo' => '1',
'fornecedor' => ' Representante 1',
array(
array(
'produto' => 'bolsa',
'valor' => "8,89"
),
array(
'produto' => 'bolsa 3',
'valor' => "4,36"
),
array(
'produto' => 'bolsa 3',
'valor' => "5,89"
)
)
),
array(
'codigo' => '2',
'fornecedor' => ' Representante 2',
array(
array(
'produto' => 'bolsa',
'valor' => "1,99"
),
array(
'produto' => 'bolsa 3',
'valor' => "1,49"
),
array(
'produto' => 'bolsa 3',
'valor' => " 2,99"
)
)
)
);