Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5941921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:10:42+00:00 2026-05-22T16:10:42+00:00

This question is relevant for a lightweight pagination script I am busy writing. I

  • 0

This question is relevant for a lightweight pagination script I am busy writing.

I have the total items and the page limit for every page. for example 15 items in total but I would like to paginate on 10. This means there are 2 pages. How do I get to that using a formula?

I am using ceil( $total / $page_limit ) at the moment is that right?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:10:43+00:00Added an answer on May 22, 2026 at 4:10 pm

    I am using ceil( $total / $page_limit ) at the moment is that right?

    Yes, it is. If there is nothing to round (e.g. if the outcome is not a float) it will simply return the outcome. If the outcome is a float, it will round it up (next highest integer value), so you’ll have one page with less items than the rest, but that shouldn’t be an issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables (well, two relevant for this question) : Bets (holds the
This question is no longer relevant now that microsoft have released a proper version
In my domain, I have 2 bounded contexts that are relevant to this question:
I have a solution with two relevant (to this question) projects, and a few
I have a (DAL) Data Access Layer (but this question is relevant for DAOs
This should be a simple question, but I just can't recall the relevant API.
EDIT 22 March 2011 : This question is no longer that relevant since Youtube
(I'm using rspec in RoR, but I believe this question is relevant to any
edit 2015 This question and its answers are no longer relevant. It was asked
Quick background info: of the three database tables that are relevant for this question,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.