PHP Number ranges
05:48 10 Dec 2014

I'm having a complete mental block on how to do this..

I have 'x' DB entries. I want to list them in blocks of 'y'.

I'm starting to try and do this just with numbers within PHP, then I'll consider the DB side.

$total = '200';
$perpage = '10';

So I'm trying to get the following output:

1,10
11,20
21,30
31,40
41,50 
etc

If $perpage was 20, then the results would be :

1,20
21,40
41,60
etc

This is what I've got so far.. and it's way off !

$total = '200';
$page = '10';
$base = '1';

echo $total / $page."
"; $list = $total / $page; for ($n=1;$n<=$list;$n++) { echo "$n,".$n * $page."
"; }

Can some one point me in the right direction for doing this. Forget the DB, I@m interested in doing this with number as above to start with.

Thanks

php pagination numbers