Topic: PHP pagination
I found this guide on how to create a paginated image gallery in PHP. I have adapted it to suit my needs, but there is one bit which is completely stumping me.
I reckon you'd have to read it all to be able to help me, so please do, if you have the time:
http://www.lateralcode.com/simple-php-g agination/
The bit which is confusing me is:
$count = 0;
$skip = $page * $per_page;
while ( $count < $skip && ($file = readdir($handle)) !== false ) {
if ( !is_dir($file) && ($type = getPictureType($file)) != '' )
$count++;
}
the reason is, on the next line, it resets $count to 0, so the above loop to me seems pointless. I took it out and re-ran the code and it breaks so it is needed.
But all it does is increment count until count equals skip and then it is reset on the next line anyways.
i think the main reason im getting so confused is that the article isn't explaining it wel enough, perhaps because they don't expect the reader to be a noob, ha.
help me someone please
.

