[Solved] Continue loop after 8 results – separating into whole new table


Ok so if we assume that $table3[‘body’] has the same count of elements as $table3[‘header’] your code basically starts building the table header fine, but when we get to the body during the first 8 loops you have the table create
rowspans?

Should this not be colspans?
https://plnkr.co/edit/B31QPDamCDHiQANAYpdx?p=preview

<table width="100%" border="1" cellspacing="0" cellpadding="0">
<thead>
        <th>1 Rowspan Table</th>
        <th>2</th>
        <th>3</th>
        <th>4</th>
        <th>5</th>
        <th>6</th>
        <th>7</th>
        <th>8</th>
        <th>9</th>
  </thead>
<tbody>
<!-- **Invalid table structure and markup:** -->
<tr>
  <td class="lefttitle bold tdtitle">$td3['c']</td>
  <td rowspan="4">&nbsp;</td>
  <td rowspan="4">&nbsp;</td>
  <td rowspan="4">&nbsp;</td>
  <td rowspan="4">&nbsp;</td>
  <td rowspan="4">&nbsp;</td>
  <td rowspan="4">&nbsp;</td>
  <td rowspan="4">&nbsp;</td>
</tr>
<!-- **VALID table structure and markup:** -->
<tr>
  <td class="lefttitle bold tdtitle">$td3['c']</td>
  <td colspan="4">&nbsp;</td>
  <td colspan="4">&nbsp;</td>
</tr>

Also after the %8 the same row carries on with rowspan depending on the amount of elements in $tr3 as $td3. (if this is consistent with the amount of elements in $table3[‘header’];)

Another problem is that if for some reason $td3[‘c’] is empty the whole Table structure is thrown out the window.

You are relying on too many unknown variables to build the table structure for youself.

I would only loop through $table3[‘header’] once and build your table logic inside this loop to prevent confusion and mismatched counts of elements.

It is unclear which cells you want to span over which cells: could you please merge the cells you want inside an Excel sheet as an example and attach that with your question. Then I can provide a simpler solution for you.

solved Continue loop after 8 results – separating into whole new table