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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:26:26+00:00 2026-06-15T16:26:26+00:00

I am trying to do a dynamic paging for my mySQL database. Results per

  • 0

I am trying to do a dynamic paging for my mySQL database. Results per page are 20, and the number of pages (displayed at the bottom) is dependent on $totalPages

I am currently having some trouble escaping strings after the for-loop. Can someone help me double check?

$result = mysql_query("SELECT COUNT(0) FROM Spreadsheet");
$rows = mysql_fetch_array($result);

$total = $rows[0];
$totalPages = ceil($total/20);
$i=0;

$pages = "Pages :";

    echo $pages;

    for ($i; $i<$totalPages; $i++){
    echo "<a href=\"index.php?page='$i'rpp=20\">$i</a>";

    }

The results should look like this:

Pages: 1, 2, 3, 4, 5, etc..

Thank you for the help!

  • 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-15T16:26:27+00:00Added an answer on June 15, 2026 at 4:26 pm
    for ($i; $i<$totalPages; $i++){
       echo '<a href="index.php?page='.$i.'&rpp=20">['.$i.']</a>';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a SQL query that returns results based on a dynamic number
I am trying to create dynamic pages without creating new files and getting the
I am trying to create dynamic menus from the database using the following example
I'm trying to do a dynamic order by on pubs database and getting the
I'm trying to create dynamic tables in my registration page and I've given up
I'm trying to make dynamic text scroll on the page. I want it to
I'm trying out some dynamic web page background generation using lines and text. Take
I'm trying to create dynamic multi level menus fetching the data from a MySQL
I’m trying to do dynamic switching of the master page in SharePoint 2007 publishing
I am trying to insert dynamic pages inside my fixeddocument in a loop FixedPage

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.