Re: flushing data as it's being generated

From: Date: Tue, 12 Nov 2002 14:34:44 +0000
Subject: Re: flushing data as it's being generated
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-124001@lists.php.net to get a copy of this message
Thanks, that did the trick! Should've read the documentation on flush( ). =] ----- Original Message ----- From: "Jason Wong" <php-general@gremlins.com.hk> Newsgroups: php.general To: <php-general@lists.php.net> Sent: Tuesday, November 12, 2002 6:18 AM Subject: Re: [PHP] flushing data as it's being generated > On Tuesday 12 November 2002 22:10, arch wrote: > > Hi.. > > > > I'm using php to pull data from a mysql table and output it to the browser. > > Pretty basic stuff. The problem is that the output is very slow, seen from > > the browser end, because the html output isn't displayed at all until all > > the data has been retrieved. Actually it's just the <table> part of the > > html that delays. Every <table> row corresponds to a row from the mysql > > table, and many rows are being displayed. > > > > However, I've seen php generated pages that display the data even as it's > > being pulled from the database. So the delay time isn't as hard to endure. > > > > I'm wondering if anyone knows what the trick is to output a large volume of > > html data from php in the second way. I've tried adding flush to the end of > > every iteration of the loop that's looping through the rows of data, but it > > doesn't help. > > Most browsers only start rendering tables when they see the </table> tag. One > solution is to split your single table into multiple tables each with, say 10 > rows. However one drawback using this method is that if you do not specify > the column widths then they can vary from table to table and it may look a > bit odd. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Objects are lost only because people look where they are not rather than > where they are. > */ >

« previous php.general (#124001) next »