$competitions = pl_get_all_competitions(); if ($competitions){ foreach ($competitions as $competition){ /* last round */ $lastround = $competition['next_round']-1; if ($lastround < 1){$lastround = 1;} $html .= pl_get_results_mini_table($competition['id'],$lastround, $count); /* master table */ $html .= pl_get_results_mini_table($competition['id'], 0, $count); }} echo $html;