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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:16:48+00:00 2026-06-01T20:16:48+00:00

I tried to achieve a method in which I create a scoreboard (while loop)

  • 0

I tried to achieve a method in which I create a scoreboard (while loop) and order the fetched results by a certain numeric field (points). But what I need to achieve is like the following

rank----username--point
1st------test-----------3200
2nd-----test2---------1200

etc.. I paginate my results and limit 25 results per page. I tried a while loop in the following way

while($row = mysql_fetch_array($query) || $i<=$totalnumberofrows ){
   echo out the results
$i++
}

What this does is number from 1 to 25 perfectly, but on the other hand, on page 2 it numbers again from 1-25.
Is there a trick to achieve what I need to achieve?
I.e. continuous numbering from 1 to (total number of rows) even when paginated.

  • 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-01T20:16:49+00:00Added an answer on June 1, 2026 at 8:16 pm

    What you’re looking for is the MySQL LIMIT statement. For example, the following query would return entry 0-24 (so, the first 25 entries in your database):

    SELECT * FROM entries ORDER BY `points` LIMIT 0, 25
    

    Say that you want to fetch the second page (the next 25 entries), you can do:

    SELECT * FROM entries ORDER BY `points` LIMIT 25, 25
    

    Most important thing to note here is that the first argument is the row where it should start, and the second argument is not the last row, but the total amount of rows it should return.

    To determine the starting point, simply do (($page_number – 1) * 25), assuming your first page is numbered 1. You could for example do the following:

    <?php
    $start = (($page_number - 1) * 25);
    $query = "SELECT * FROM entries ORDER BY `points` LIMIT {$start}, 25";
    // ... rest of your code goes here ...
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I create a numeric text box in java swing , which has
I found this code to achieve the desired effect and tried it on JSFiddle
I want to achieve this using html and css: I have tried to set
I'm trying to create a button which displays animated images. I read in this
I found out a method which is changed some time back and I need
So i have some bodies(which i can create more and more at runtime), and
I'm currently trying to create a page with dynamically generated images, which are not
I'm trying to create a context menu which will be able to add extra
Tried following the instructions here: How to use Google app engine with my own
Tried this: $('.link').click(function(e) { $.getScript('http://www.google.com/uds/api?file=uds.js&amp;v=1.0', function() { $('body').append('<p>GOOGLE API (UDS) is loaded</p>'); }); return

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.