I need to do a rowspan inside a for
And the result I want to get is the following:
I've tried this but it doesn't work
<table id="tablaCS" class="table table-striped table-bordered">
<tr>
<th colspan="3"></th>
</tr>
<tr>
<th></th>
<th>Org Account</th>
<th>Total</th>
</tr>
<tr>
<?php
for ($i=0; $i < count($listadoMT_SMS_DATA["ORG_ACCOUNT"]) ; $i++)
{
if($listadoMT_SMS_DATA["ORG_ACCOUNT"][$i] == 'OtaDMC' or $listadoMT_SMS_DATA["ORG_ACCOUNT"][$i] == 'otarca1')
{
echo "<tr>
<td></td>
<td>".$listadoMT_SMS_DATA["ORG_ACCOUNT"][$i]."</td>
<td><strong>".$listadoMT_SMS_DATA["TOTAL_MT"][$i]."</strong></td>
</tr>";
}
}
?>
</tr>
You need to put a condition on the
echo
inside of thefor
to put therowspan
.I have given you as an example the
rowspan=2
because of the example you have given and the condition$i=0
because it is valid for this example.But if you need to group them in some way you will have to find a suitable condition and add the
rowspan
one you want.