Page 1 of 1

output buffering question

Posted: Tue Feb 24, 2004 8:49 pm
by d3ad1ysp0rk
I'm assuming ob_ functions are what I'm going to need for this, but I'm stuck on exactly how to do it. I've been experimenting with ob_start(); ob_flush(); and stuff like that, but I just can't get my desired result :\

I want to have a type of loading thing, almost like

echo "processing";
insert into db blah blah blah
echo "calculating";
for($i=0;$i<$num;$i++){
$val = $val2*$val2 / 2 + $val;
}
echo "Done.";
echo "Value: " . $val;

it wont be really like that, but as a general thing, how would i go about doing that?

Posted: Sun Feb 29, 2004 11:39 am
by nigma
I've briefly tried to do similar things using PHPs ob_* functions but didn't succeed. So anyway, if anyone replies to this post and helps him out I would also benefit :)

Posted: Sun Feb 29, 2004 11:45 am
by penguinboy
You can't do this with php.
Php is a server side language.

Posted: Sun Feb 29, 2004 12:33 pm
by devork
i wanted to do this type of stuff with tables like
"loading data..." and ta da! it shows up.

Posted: Sun Feb 29, 2004 12:46 pm
by patrikG
I would go about this using ob_start with a callback function.

Every time you ouput something that function gets called and you can increase the percentage of "loaded". But (and here lies the dead fox), you'll need to break the output buffering to display the percentage/output.

Do bear in mind that you can't "refresh" the screen from PHP.

Posted: Mon Mar 01, 2004 12:55 pm
by Weirdan
Lil, take a look:
http://www.dnsstuff.com/tools/tracert.ch?ip=google.com
are you talking about something like that?

Check html source of that page.