zipp Posted March 13, 2008 Share Posted March 13, 2008 I am trying to write a script what will write 1-100, but will not need to finish running before the page loads. What currently happens: page waits till 1-100 is printed, then loads. What I want to happen: page loads, 1 appears, then 2 appears, then 3 appears, etc. Does anyone know how this might be done? (Would it be something with AJAX?) Link to comment https://forums.phpfreaks.com/topic/96056-auto-refresh/ Share on other sites More sharing options...
Blissey Posted March 13, 2008 Share Posted March 13, 2008 You can't do it with PHP because it is serverside. You need to use javascript. Link to comment https://forums.phpfreaks.com/topic/96056-auto-refresh/#findComment-491775 Share on other sites More sharing options...
l0ve2hat3 Posted March 13, 2008 Share Posted March 13, 2008 no thats untrue. here this works <? $i=0; while($i < 100){ $i++; sleep(1); echo $i." "; flush(); ob_flush(); } ?> Link to comment https://forums.phpfreaks.com/topic/96056-auto-refresh/#findComment-491808 Share on other sites More sharing options...
zipp Posted March 14, 2008 Author Share Posted March 14, 2008 Awesome You made my day. Thank you very much. Link to comment https://forums.phpfreaks.com/topic/96056-auto-refresh/#findComment-491816 Share on other sites More sharing options...
l0ve2hat3 Posted March 14, 2008 Share Posted March 14, 2008 use the usleep function to sleep in microseconds usleep(10000); Link to comment https://forums.phpfreaks.com/topic/96056-auto-refresh/#findComment-491831 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.