diamondtron Posted June 18, 2012 Share Posted June 18, 2012 Hi, I have a PHP script which runs for around 60 mins, It contains code somewhat similar below. while(loop through sql query results) { if(condition_check) echo "OK" else echo "Not OK" } The problem is i am getting the final output displayed on the page only after when the whole scripts finishs (~ 60 mins). What is want is as soon as condition is checked the result should be displayed and then it should move on to next iteration. I tried adding flush() but it doesnot work, Can anyone help me out. Thanks a lot in advance. Quote Link to comment https://forums.phpfreaks.com/topic/264370-script-results-only-shown-after-whole-script-execution/ Share on other sites More sharing options...
Kieran Menor Posted June 18, 2012 Share Posted June 18, 2012 Maybe output buffering is enabled? Try calling ob_flush() before flush() Quote Link to comment https://forums.phpfreaks.com/topic/264370-script-results-only-shown-after-whole-script-execution/#findComment-1354789 Share on other sites More sharing options...
diamondtron Posted June 18, 2012 Author Share Posted June 18, 2012 Thanks, Yes, outbut buffering was on, I changed the setting to "off", now its working fine. Quote Link to comment https://forums.phpfreaks.com/topic/264370-script-results-only-shown-after-whole-script-execution/#findComment-1354797 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.