Previous "; } else echo "Previous "; /* display the next 10 and previous 10 pages */ $pageRange = 10; if($currentPage > $pageRange) $startPage = $currentPage - $pageRange; else $startPage = 0; if($currentPage + $pageRange < $totalPages) $endPage = $currentPage + $pageRange; else $endPage = $totalPages; /* display the desired range */ for($x = $startPage; $x <= $endPage; $x++) { if($x != $currentPage) echo "$x "; else echo "$x "; } if($currentPage < $totalPages) { $nextPage = $currentPage + 1; echo "Next "; } else echo "Next "; } $commentsPerPage = 10; $currentPage = 0; if($_REQUEST['page']) $currentPage = $_REQUEST['page']; if($_REQUEST['commentsPerPage']) $commentsPerPage = $_REQUEST['commentsPerPage']; $totalPages = floor(getNumberOfComments()/$commentsPerPage); if($commentsPerPage > 100) $commentsPerPage = 100; /* display page selection links */ echo "
"; echo "Page $currentPage of $totalPages
"; display_range($currentPage, $pageRange, $totalPages, $commentsPerPage); echo "
"; echo "
"; /* display the option to choose how many comments per-page to disable */ echo "
"; echo "Number of comments per page:"; echo ""; echo ""; echo ""; echo "
"; echo "
"; /* query for all of the commentId's, ordering by their time in reverse order */ $offset = $currentPage * $commentsPerPage; $commentIds = mysql_query("SELECT commentId from appComments ORDER BY ". "appComments.time ASC LIMIT $offset, $commentsPerPage;"); while ($ob = mysql_fetch_object($commentIds)) { $qstring = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ". "commentId, parentId, appId, versionId, userid, subject, body ". "FROM appComments WHERE commentId = $ob->commentId;"; $result = mysql_query($qstring); /* call view_app_comment to display the comment */ $comment_ob = mysql_fetch_object($result); view_app_comment($comment_ob); } /* display page selection links */ echo "
"; display_range($currentPage, $pageRange, $totalPages, $commentsPerPage); echo "
"; apidb_footer(); ?>