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?) Quote Link to comment 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. Quote Link to comment 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(); } ?> Quote Link to comment 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. Quote Link to comment 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.