I have following item list fetch from table, I need to add dynamic rowspan
at the end of the row if item is from same supplier, but I have no idea how to work with this.
I tried:
foreach($items as $item){
/*get total num for rowspan*/
$group = $buyer->get_total_rowspan($obj->id, $obj->supplier);
echo '<tr>
<td>$item->id</td>
<td>$item->name</td>
<td>$item->supplier</td>';
if($group->countRow > 1){
<td rowspan="$group->countRow"><a>Manage</a></td>
}
if($group->countRow > 1){
echo '<td rowspan="'.$group->countRow.'"><a>manage</a></td>';
}else{
echo '<td><a>test</a></td>';
}
echo '</tr>';
}
but cell Manage
will always appear at every row with mess format.
the idea results that I want:
You can try something like that:
Everytime there is a new group you can set the $i back to 0.