Look like the code is using a
while
loop to print out all the number into a cell but it should only print 1 number per cell.
Maybe an
if
statement should do it.
Assuming
$ts_qty = 5
; Then replace the while loop with the following
if ($x<=$ts_qty){
echo $y;
$y++;
}