0

I print my table like that:

print $tableHeader . $dataRow . $tableFooter;

the $dataRow is the result of a loop (getting data from DB and building the row, nothing unusual), it's something like:

while ($obj = mysql_fetch_object($res)) { 
  $dataRow .= ' <td width="210" style="...">' . $obj->title . ' <br /> '. $obj->screenName .' </td>';
  ...
  ...
}

The problem is when there is a huge amount of information to handle => huge amount of rows to build before displaying the final table.

How could I tell Apache to display it row by row ?

3

2 Answers 2

1

You could do it with Ajax.

  1. You can make a pagination. When you click on a page, you load only the x results.
  2. You can trigger the user's scroll and load more results.

I personnally use DataTables which can do the two things : http://www.datatables.net/

Hope that helps !

Sign up to request clarification or add additional context in comments.

Comments

0

Can't you paginate?

the way to go is to tell php to display piece by piece, but you will have to change your code a bit to something like.

print $tableHeader 
while ($obj = mysql_fetch_object($res)) { 
   print ' <td width="210" style="...">' . $obj->title . ' <br /> '. $obj->screenName .' </td>';
  flush();
}
print $tableFooter;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.