I was wondering how can I do this: add something to a database echo a dot add something else echo another dot .. but this in real time, not doing all and echo the dots after. I tried with a sleep() but doesn`t do what I need. Any ideas?
If you ran it from a command line then it'd work with echo, otherwise you'll probably want to look into something like Ajax, I'm not sure - is there any reason why you want to do this?
use ob_flush(); http://ca3.php.net/ob_flush // do your database insert echo "."; ob_flush(); // do another insert echo "."; ob_flush(); PHP:
in pure php, you would have refresh the full page when you print a dot... the only way to do this would be by using ajax/javascript...
Use the function ob_implicit_flush(true); PHP: on the start of your script. Note, though, that some browsers (IE, for example) require some amount of html received to start displaying.