tags:

views:

68

answers:

2

Basically I can't get it right.

I need something like this:

if($p == 1)
{
    $start = 0;
    $limit = 16;
}

The numbers must add on depending on the value of the $p, e.g. if $p is 5 then the values of $start and $limit would be:

if($p == 5)
{
    $start = 64;
    $limit = 80;
}

The math is to add 16, depending on the value of $p.

Thanks.

+5  A: 
$start = ($p - 1) * 16;
$limit = $start + 16;

And don't forget to add a test for when $p < 1

Soufiane Hassou
Thanks. Already done the $p < 1 :)
YouBook
+2  A: 
$start = ($p - 1) * 16;
$limit = $p * 16;
xaph