Can you explain what your code is doing, how it works, etc. I'm sure there's a way to fix this, but I'd need more info as to what your code does (obviously you can go forward and backwards through the customer list).
You could maybe use next and previous links, setting a limit of 1 result per page? It really depends on what you're doing.
also on your if statement, don't use one equal sign or only the first if would be executed EVERY time. one equal sign means assigned to, two equal signs means is equal to
// if forward is assigned to direction
if ($direction = 'forward') // will always return true
// if $direction is equal to forward
if ($direction == 'forward') // will return true only if $direction is equal to foward
Cgraz