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 9088445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:54:36+00:00 2026-06-16T21:54:36+00:00

How can I implement custom pagination in mysql using a query? Based on the

  • 0

How can I implement custom pagination in mysql using a query? Based on the page number I need to fetch the records from the database, is it possible? It would be helpful to get some queries for this.

Thanks.

  • 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-06-16T21:54:37+00:00Added an answer on June 16, 2026 at 9:54 pm
    SELECT * FROM items LIMIT 0,10
    

    To display your pagination you also need to know the total of rows in order to calculate the number of page links to display like:

    Page: 1 2 3 4 5 6 ….

    Making a query to MySQL to count the number of rows like “SELECT COUNT(*) …” is not an option, you would lose some of the performance you saved with the “LIMIT” query in the first place. There’s a much more efficient way of doing this, you just need to modify your original query just a little, like:

    $result = mysql_query('SELECT SQL_CALC_FOUND_ROWS * FROM items LIMIT 0,10');
    

    Immediately after that first query you run:

    $countData = mysql_fetch_assoc(mysql_query('SELECT found_rows() AS total'));
    $totRows = $countData['total'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement pagination in a custom WP-Query. The pagination is done correctly,
How can I implement role based custom user authentication in asp.net MVC 3. Consider
How can I implement a custom onClickListener for the Home button of the Action
How can I implement a custom swipe animation instead of the standard horizontal movement?
I'm trying to implement some custom model metadata in ASP.NET MVC 3. I can't
How can implement reordring in winforms datagridview by using the feature of drag and
I have panel with two toolbars . How can I to implement custom class
I want to implement custom search and have one trouble. I need to combine
I need to implement custom fields in a booking software. I need to extend
can any one have idea how to implement custom paging in silverlight / telerik

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.