// how many rows we have in database
$query2 = "SELECT * FROM gallery";
$result3 = mysqli_query($query2) or die('Error, query failed');
$numrows2 = mysqli_num_rows($result2);
// how many pages we have when using paging?
$maxPage2 = ceil($numrows2/$rowsPerPage2);
// print the link to access each page
$self2 = $_SERVER['PHP_SELF'];
$nav2 = '';
for($page2 = 1; $page2 <= $maxPage2; $page2++)
{
if ($page2 == $pageNum2)
{
$nav2 .= " $page2 "; // no need to create a link to current page
}
else
{
$nav2 .= " $page2 ";
}
}
if ($pageNum2 > 1)
{
$page2 = $pageNum2 - 1;
$prev2 = " [Prev] ";
$first2 = " [First Page] ";
$showmore = " 更多作品 ";
}
else
{
$prev2 = ' '; // we're on page one, don't print previous link
$first2 = ' '; // nor the first page link
$showmore = " 更多作品 ";
}
if ($pageNum2 < $maxPage2)
{
$page2 = $pageNum2 + 1;
$next2 = " [Next] ";
$last2= " [Last Page] ";
$showmore = " 更多作品 ";
}
else
{
$next2 = ' '; // we're on the last page, don't print next link
$last2 = ' '; // nor the last page link
//$showmore = " more news ";
}
// print the navigation link
echo $showmore ;
?>