Jump to content

Archived

This topic is now archived and is closed to further replies.

redarrow

sleep() controll

Recommended Posts

i thort this but dosen work first show an animated pic then echo message.


<?php

sleep(2);


$img="<img src='images/x.gif'</img>";
echo $img;


sleep(5);


if($_GET['cmd']==delete){

echo "delete database entry";

}else{

echo "no not there ok!";

}


?>

Share this post


Link to post
Share on other sites
No this is not how sleep works. Sleep only stops the PHP Intepreter for the number of secounds defined. It does not pause, print something, then pause again and print something else.

Share this post


Link to post
Share on other sites
You can try toying around with the output buffer but its highly browser specific and not really worth your while attempting.

This sort of thing would be best handled by javascript / ajax.

Share this post


Link to post
Share on other sites
can you give a quick example ajax way please chers.

Share this post


Link to post
Share on other sites
Would'nt really need to be ajax unless your retreiving data from a database, pure javascript would do, and there is a whole other forum for such questions.

Share this post


Link to post
Share on other sites
try looking up javascript DHTML

here is a good start

http://www.golivecentral.com/pages/txttut/jstut/innerhtml.shtml

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.