$next variable is set every iteration and at the end of
fetch loops. Inside
the loop, it is equivalent to the iteration count, starting from 1.
At the end of the loop, it is the value to use for
SKIP in a
SQL to continue iterating at the next value.
$next has the same value as
$loop (plus 1 inside), but for
$next is equal
$loop plus the initial
SKIP value (plus 1 inside).