No announcement yet.

Getting echo to work in a blank application during processing

  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting echo to work in a blank application during processing

    I have a blank application in which some processing is done against the database. As this does take quite some time, I have inserted both HTML (with the "?>" and "<?PHP" tags before and after the HML respectively) for the OnExecute event. After the HTML come the PHP code that interacts with the database. Included in this code, are a number of echo statements giving regular progress information. My intent was to let the user know what was going on as well as giving regular status updates.

    Unfortunately, the above does not work. The HTML and echo statements give the expected output, but they are only displayed after the PHP code in the OnExecute event has run to the end. Thus, the user will see only a blank page for a long time, and then suddenly at the end, my HTML as well as the accumulated status messages are displayed in one go.

    Now, I have used some time trying to find a solution in PHP and the answer mostly given, is to use the flush() and ob_flush() functions. However, they seem to have no effect whatsoever.

    Any suggestions on how to get an update to the screen while the PHP code executes would be appreciated.
    Last edited by Orion; 06-28-2015, 01:56 PM.
    Best regards,


  • #2
    commonly you will use something like Jscript or ajax to do something like that.



    • #3
      @kafecadm, Well, if that works and is not too complicated to implement, I can give it a try. I am sure that it will look elegant and professional compared to just echo statements.

      ScriptCase and PHP has been like stepping into the shoes and just walking due to my experience with C and C#, especially since I have worked with SQL and many types of databases as well. However, the web programming model besides basic HTML / CSS is somewhat new for me. Thus, I would appreciate if you could point me in the right direction in the form of some examples, an article, video, etc.

      I will soon get up to speed on JavaScript and AJAX (there is no way around that). However, I need this project completed rather fast, so I was hoping to just make do with echo in the first version and improve the UI of that part of the application later.
      Last edited by Orion; 06-29-2015, 02:14 PM.
      Best regards,



      • #4

        For me is working this function, called on certain point of processing code (like after while,for..):
        function message_time() {
        echo "<br> Timestamp : " . date('m/d/Y h:i:s a', time()) . " <br>";

        I think browser is need some time to refresh.

        Let me know if is working for you.

        Ionut B.


        • #5

          Well, I'm not a complete expert but I would do something like this:

          when you execute your php code.. add something along the lines of:

          PHP Code:
          echo '
          <script> //javascript code
             getElementsbyId("The Id of your display field or iframe or div").InnertHTML = "Ok.. now system is making magic and turning coil into diamons while your lazzyness increases >.<";

          Take a look at

          Hope this helps...

          Last edited by kafecadm; 06-29-2015, 04:12 PM. Reason: forgot the semicolon ;P


          • #6
            Thanks ionutberlea and kafecadm,
            I will experiment with these two methods and see what works.
            Best regards,