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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:19:03+00:00 2026-05-15T23:19:03+00:00

i have one php page with paging option i use follwoing sql statement to

  • 0

i have one php page with paging option

i use follwoing sql statement to generate total number of pages

      $rowsPerPage=25;
      $pageNum = 1;
      if(isset($_GET['page']))
      {
      $pageNum = $_GET['page'];
      }
      $offset = ($pageNum - 1) * $rowsPerPage;

      $query   = "SELECT COUNT(id) AS numrows FROM TableA"
      $result  = mysql_query($query) or die('Error, query failed');
      $row     = mysql_fetch_array($result, MYSQL_ASSOC);
  $numrows = $row['numrows'];
  $maxPage = ceil($numrows/$rowsPerPage);

now i have follwoing code to write Next / Previous pages link

       $page  = $pageNum - 1;
       $prev  = " <a  href=\"$self?page=$page\" class=\"RedNorm\">[Prev]</a> ";

       $page = $pageNum + 1;
      $next = " <a href=\"$self?page=$page\" class=\"RedNorm\">[Next]</a> ";

my problem is:

when i pass any query sting with page like abc.php?m=1&page=2

that query string will not be available once i click on [Prev] / [Next] page link.

i can undersatnd the problem is in

  $prev  = " <a  href=\"$self?page=$page\" class=\"RedNorm\">[Prev]</a> ";

statement

how can i get page name plus all the query strings on place of $self as this is only getting page name.

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-05-15T23:19:04+00:00Added an answer on May 15, 2026 at 11:19 pm

    Just add the other variables to the link.

    If you don’t know what they are/might be, you might try something like this:

    $q = "?";
    foreach($_GET as $k=>$v) {
        if($k == "page") continue;
        $q .= htmlentities($k) . "=" . htmlentities($v) . "&amp;";
    }
    
    $page  = $pageNum - 1;
    $prev  = " <a  href=\"$self${q}page=$page\" class=\"RedNorm\">[Prev]</a> ";
    
    $page = $pageNum + 1;
    $next = " <a href=\"$self${q}page=$page\" class=\"RedNorm\">[Next]</a> ";
    

    That will append all the query string variables to the link, to pass it to the next page.

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

Sidebar

Related Questions

This is driving me crazy. I have this one php file on a test
I'm building a CMS in PHP and one dread I have is that the
On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts
If I have a button like the one in this image : http://www.freeimagehosting.net/image.php?4cd775814c.png how
I have one text input and one button (see below). How can I use
I have one field that I need to sum lets say named items However
I have one thread that writes results into a Queue. In another thread (GUI),
I have one hibernate sequence, that generates all sequence-numbers in my app. When I
I have one std::list<> container and these threads: One writer thread which adds elements
I have one website on my server, and my IIS Worker Process is using

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.