this piece of code reads my /videos directory which has about 1000 videos in it. and displays 20 at a time on a page then does next/prev links i did it without mysql database. just one line seems not to be working line 19. anyone can assist that would be awesome.
<?
$MYFILENAME = "format.php";
$FILESDIR = "/videos";
$OFFSETNUM = 20;
$files = dir($FILESDIR);
if (isset($_REQUEST[offset]))
{
$offset = $_REQUEST[offset];
}
else
{
$offset = 0;
}
for ($i=$offset; $i<=sizeof($files); $++)
{
echo "<a href='$files[$i]'>$files[$i]</a><br/>";
}
if ( ($offset - 20) >= 0 ) { $prevoffset = $offset - 20; } else { $offset = 0; }
if ( ($offset + 20) <= sizeof($files) ) { $nextoffset = $offset + 20; }
echo "<a href='$MYFILENAME?offset=$nextoffset'>prev 20</a> | ";
echo "<a href='$MYFILENAME?offset=$nextoffset'>next 20</a>";
?>
thanks.