I need to alter my code to display 1 table containing 8 results, stop, then produce another whole new table with result number 9 and above.
I've got the idea that the break; and continue; may be of use, but how I should wrap the whole table in a foreach loop, and prevent it displaying 8+ tables I don't know.
I am determining that there is more than 8 columns by the HEADER count. In this example there is 9 headers. Including the first blank one.
<?php
$table3 = get_field( 'bottom_chart' );
if ( $table3 ) {
if($table3['header']) {
$theader3 = 1;
foreach ( $table3['header'] as $th1 ) {
//echo $theader3;
$theader3++;
}
}
echo '<table border="0" class="mytable">';
if ( $table3['header'] ) {
echo '<thead>';
echo '<tr>';
foreach ( $table3['header'] as $t3 ) {
echo '<th class="tdtitle">';
echo $t3['c'];
echo '</th>';
}
echo '</tr>';
echo '</thead>';
}
echo '<tbody>';
$first_td_bottomchart = 0;
foreach ( $table3['body'] as $tr3 ) {
echo '<tr>';
foreach ( $tr3 as $td3 ) {
if(($first_td_bottomchart %8) == 0) {
echo '<td class="lefttitle bold tdtitle">' . $td3['c'] . '</td>';
} elseif(!empty($td3['c'])) {
echo '<td rowspan="4">';
echo '<div class="progress progress-striped"><div class="bottom_chart progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $td3['c'] . '" aria-valuemin="0" aria-valuemax="100" style="width: 0%"></div></div>';
echo $td3['c'];
echo '</td>';
}
$first_td_bottomchart++;
} ?>
<?php echo '</tr>';
}
echo '</tbody>';
echo '</table>';
}
?>