The value of `count($tableInstanceColumns)` does not change within the loop. Please assign this value to a value above the loop and reference that variable on this line.