Jump to content

looking for an algorithm for number progression


sdowney1

Recommended Posts

looking for an algorithm

 

I need to take in a number from

1 -> 20 and return 1

21 -> 40 and return 2

41 -> 60 and return 3

61 -> 80 and return 4

 

etc....

yes, it also involves PHP

On one page, I display a series of records in 20 record blocks.

basically, every next shows another 20 record set.

I have a link for each record based on the record number.

Click that it loads another page which displays just that one record

On that page I move forward of back one record at a time.

SO, when I post back to the first page that displays the 20 record set, I need to figure out which set of 20 records to display.

 

this works, but I quess I posted in the wrong forum

 

I can increment every 20, and there will never be more than 10,000 record count

  $count = 1;

  while ($count <= 10000)

    { 

    if (($rpos>=$count) and ($rpos<($count+20))){$dum = $count;break;} 

    $count =($count +20);

    }

 

  echo 'weirdcounter'.$dum.'<BR>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.