Basically this is my array
Array
(
[0] => Array
(
[mainProdName] => CellPhone
[mainproductname] => Array
(
[0] => Array
(
[subProdName] => TG8
)
[1] => Array
(
[subProdName] => TG5
)
)
)
[1] => Array
(
[mainProdName] => LapTop
[mainproductname] => Array
(
[0] => Array
(
[subProdName] => TD9
)
[1] => Array
(
[subProdName] => TD7
)
)
)
[2] => Array
(
[mainProdName] => Corn
[mainproductname] => Array
(
[0] => Array
(
[subProdName] => SWEET CORN
)
)
)
)
I am trying to display this result in an HTML table
<table><tr>
?>
for($j=0;$j<count($res);$j++)
{
?><td>$res[$i].mainProdName}</td><?php
for($k=0;$k<count($res[$i].mainproductname);$k++)
{
?><td>$res[$i].mainproductname[$k].subProdName}</td><?php
}
}
<?php
</tr></table>
For which i'm getting this.
----------------------------------------------------------------
CellPhone | TG8 | TG5 | LapTop | TD9 | TD7 | Corn | SWEET CORN
----------------------------------------------------------------
Basically i need to display the result in this format
-------------------------------------------------------------------
CellPhone | LapTop | Corn
-----------------------|------------------------|------------------
TG8 | TG5 | TD9 | TD7 | SWEET CORN
-------------------------------------------------------------------
For every main product, respective subproduct list should be displayed below in a separate row.
