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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:01:53+00:00 2026-05-16T21:01:53+00:00

I have an application where I need to retrieve a large amount of rows

  • 0

I have an application where I need to retrieve a large amount of rows from the database and then print them all on the screen. I’ve checked the mysql queries, and that’s not where the problem is. The problem is the rows all need to be printed on the same page, with no pagination, and it takes a long time (I’m talking about a table with several thoudands of rows). Is there any way to speed things up? The only thing I’ve found on Google is using “,” instead of “.” when using echo. I’ll be testing this to see if there is any improvement, but I’m not sure it will make such a big difference.

  • 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-16T21:01:53+00:00Added an answer on May 16, 2026 at 9:01 pm

    The problem is unlikely PHP, it’s the massive amount of HTML being output to the browser. You could verify this yourself by saving the page that you get, then loading the static file from your hard drive.

    If you are outputting a large table, then the browser will often have problems with “redrawing” it as content is loaded. This can be minimized by setting a fixed width for all the columns. Just do this on the first row.

    You can also jump out of the PHP block to output most of the HTML, then just print the variables where appropriate. Here’s an example, assuming all your data is in the $rows variable:

    <?php
      // some code here
    ?>
    
    <table>
    <thead>
    <tr>
      <th width="50">Header 1</th>
      <th width="200">Header 2</th>
      <th width="150">Header 3</th>
      <th width="100">Header 4</th>
    </tr>
    </thead>
    <tbody>
    <?php foreach ( $rows as $r ) : ?>
    <tr>
      <td><?=$r['var1']?><td>
      <td><?=$r['var2']?><td>
      <td><?=$r['var3']?><td>
      <td><?=$r['var4']?><td>
    </tr>
    <?php endforeach; ?>
    </tbody>
    </table>
    
    <?php
      // continue here if necessary
    

    Note: if you don’t have PHP short tags enabled you’ll need to do <?php echo $r['var1'] ?> instead.

    Finally, you can try adding gzip compression. It’s best done at a server level but in PHP you can do add the line ob_start("ob_gzhandler"); as the very first line of PHP code right after <?php.

    If this still does not help, then it’s a simple fact that your table is way too big. You’d be much better off using pagination or filtering to keep the size down.

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

Sidebar

Related Questions

I have an application where I need the user to upload a photo. After
I have a java application I need to pass some info to a C++
I have an application where I need to populate a textbox with a company
I have an application where I need to use 'Basic Authentication'; however, in order
Using C# and the .Net framework 2.0. I have an MDI application and need
I have a PHP application and a need to generate a PDF with the
I have an application (an IP conferencing service) that I need to scale. It
I have an application that when it first starts i need it to run
I have an application running on multiple IIS servers that need to parse a
I have an application on which I am implementing localization. I now need to

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.