', $limit_body); $query_more = "SELECT * FROM post_more_picture WHERE art_id = '$id' ORDER BY id DESC"; $result_more = mysqli_query($conn,$query_more) or die(mysqli_error($conn)); $more = mysqli_num_rows($result_more); print "
Add/Change Picture
"; // how many rows we have in database $query = "SELECT COUNT(id) AS numrows FROM post WHERE category = '$type'"; $result = mysqli_query($conn,$query) or die(mysqli_error($conn)); $row = mysqli_fetch_array($result); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; // no need to create a link to current page } else { $nav .= " $page "; } } // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1) { $page = $pageNum - 1; $prev = " [Prev] "; $first = " [First Page] "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " [Next] "; $last = " [Last Page] "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the navigation link echo $first . $prev . $nav . $next . $last; // and close the database connection // include '../conn/closedb.php'; ?>