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

  • Home
  • SEARCH
  • 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 9201777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:06:01+00:00 2026-06-17T23:06:01+00:00

In my pagination code, I list 5 buildings per page and number them from

  • 0

In my pagination code, I list 5 buildings per page and number them from 1 to 5,

<?php
$page = intval($_GET['page']);
if(!$page) $page = 1;
$totalno=mysql_num_rows(mysql_query("SELECT M1_ID FROM M1Buildings WHERE M1_Cat2 BETWEEN 3 AND 4 && M1_Status=5"));
$limit = 5;
$show = $page * $limit - $limit;
$buildinglist = mysql_query("SELECT * FROM M1Buildings  WHERE M1_Cat2 BETWEEN 3 AND 4 && M1_Status=5 ORDER BY M1_Height DESC LIMIT $show,$limit",$con);
$firstrowno=1;//This will be 1 for page 1, 6 for page 2, 11 for page 3 etc..
?>

Some html code here, then:

<?php
$startno=1;//This is the number of each row, starting from 1
while ($rowblist = mysql_fetch_array ($buildinglist))
{
echo '<tr>
        <td>'.$startno.'</td>
<td>Some information here</td>
<td>Some information here</td>
    </tr>';
    $startno++;
    $firstrowno+5;
}
?>

There is no problem in first page, but when I pass to page 2, it again starts from 1, but I want it starts from 6, I couldn’t get how can I achieve it. I’ve performed a search, but no result. Actually with my limited english, I can’t know how to search it with proper words, I guess. Thanks for your understanding!

  • 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-17T23:06:03+00:00Added an answer on June 17, 2026 at 11:06 pm

    You need to update your query to use offset. (** Sorry, didn’t notice you were using the shorthand **)

    Took a moment for me to get the gist of the question.
    Use:
    $startno = $show + 1;

    instead of:
    $firstrowno= 1;

    After the HTML:

    <?php
    while ($rowblist = mysql_fetch_array ($buildinglist))
    {
    echo '<tr>
            <td>'.$startno.'</td>
    <td>Some information here</td>
    <td>Some information here</td>
        </tr>';
        $startno++;
    }
    ?>
    

    The variables do not retain their state between trips to the server. (Unless you store them and retrieve them from sessions.

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

Sidebar

Related Questions

I have this Java code which is used for JSF pagination: public List<ActiveSessionObj> list(int
We are writing some code to control the pagination of results returned from a
Using the following code to display a list of friends from my twitter profile.
I have a php code which generates pagination links. I have ol > li
I have a problem with Magento pagination. The prudct list page i call by
I need some asp.net pagination code samples. I would like suggestions on open source
I've have already implemented pagination using the following code: public Paginacao<Anuncio> consultarPaginado(int pagina, Integer
i've used jquery load method for a website pagination here is my code function
What is the best way to implement simple pagination? Here is the code im
This my jquery function, function getRecordspage(curPage, pagSize) { // code here $(.pager).pagination(strarr[1], { callback:

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.