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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:53:55+00:00 2026-05-24T16:53:55+00:00

The HTML table below is paginated. On page one, $count++ starts at one and

  • 0

The HTML table below is paginated. On page one, $count++ starts at one and then goes up, which is what I want.

The problem is that when I click on page two, $count++ starts at one again.

How can I make it start at 101 on page two?

$presult = mysql_query("SELECT COUNT(*) FROM login") or die(mysql_error());

$rr = mysql_fetch_row($presult);  
$numrows = $rr[0]; 
$rowsperpage = 100; 
$totalpages = ceil($numrows / $rowsperpage);

// get the current page or set a default  
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {  
   // cast var as int  
   $currentpage = (int) $_GET['currentpage'];  
} else {  
   // default page num  
   $currentpage = 1;  
} // end if  

// if current page is greater than total pages...  
if ($currentpage > $totalpages) {  
   // set current page to last page  
   $currentpage = $totalpages;  
} // end if  
// if current page is less than first page...  
if ($currentpage < 1) {  
   // set current page to first page  
   $currentpage = 1;  
} // end if  

// the offset of the list, based on current page   
$offset = ($currentpage - 1) * $rowsperpage; 

    $tzFrom3 = new DateTimeZone('America/New_York'); 
    $tzTo3 = new DateTimeZone('America/Phoenix'); 


    $sqlStr3 = "SELECT 
        loginid, 
        username, 
        created,
        activated

    FROM login  


    WHERE activated = 1


    ORDER BY created ASC 
    LIMIT $offset, $rowsperpage";




    $result = mysql_query($sqlStr3);

    $arr = array();
    echo "<table>";
        while ($row = mysql_fetch_array($result)) { 
                $dt3 = new DateTime($row["created"], $tzFrom3); 
                $dt3->setTimezone($tzTo3);

                echo '<tr class="backgroundnonttsu">';
                echo '<td>'.$count++.'</td>';
                echo '<td >'.stripslashes($row["username"]).'</a></td>';
                echo '<td >'.$dt3->format('F j, Y').'</td>';

                echo '</tr>';

            }
    echo "</table>";

$range = 3;  

/******  build the pagination links ******/  
// range of num links to show    

// if not on page 1, don't show back links  
if ($currentpage > 1) {  
   // show << link to go back to page 1  
   echo " <div class='pages'><a href='http://www.domain.com/directory/file.php?currentpage=1' class='links'><<</a></div> ";  
   // get previous page num  
   $prevpage = $currentpage - 1;  
   // show < link to go back to 1 page  
   echo " <div class='pages'><a href='http://www.domain.com/directory/file.php?currentpage=$prevpage' class='links'><</a></div> ";  
} // end if   

// loop to show links to range of pages around current page  
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {  
   // if it's a valid page number...  
   if (($x > 0) && ($x <= $totalpages)) {  
      // if we're on current page...  
      if ($x == $currentpage) {  
         // 'highlight' it but don't make a link  
         echo " <div class='pages'>[<b>$x</b>] </div>";  
      // if not current page...  
      } else {  
         // make it a link  
     echo " <div class='pages'><a href='http://www.domain.com/directory/file.php?currentpage=$x' class='links'>$x</a></div> ";  
      } // end else  
   } // end if   
} // end for  

// if not on last page, show forward and last page links      
if ($currentpage != $totalpages) {   
   // get next page  
   $nextpage = $currentpage + 1;  
    // echo forward link for next page   
   echo " <div class='pages'><a href='http://www.domain.com/directory/file.php?currentpage=$nextpage' class='links'>></a></div> ";  
   // echo forward link for lastpage  
   //echo " <div class='pages'><a href='http://www.domain.com/directory/file.php?currentpage=$totalpages' class='links'>>></a></div> ";  
} // end if  
/****** end build pagination links ******/
  • 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-24T16:53:56+00:00Added an answer on May 24, 2026 at 4:53 pm
    if($currentpage==1){
    $count=1;
    }else{
    $count =1+($currentpage*$rowsperpage);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following html table and script shown below I am having a problem
The HTML table below with mysql_query($sqlStr3) (the one with the word Joined in its
In the HTML table below, I would like to add a third column that
Here's my problem: I have an HTML table that looks like this: What I
I want to auto-generate a HTML table from some custom data. One of the
This is my html. The table below is inside a container div which has
I have a HTML table in a page <table id=options_table></table> I want to automatically
I have a HTML Table which is similar to the one shown (demo.jpg) in
I am trying to create a simple HTML table in which I want the
I have an html table followed by a button that says Add Row below

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.