Jump to content

Recommended Posts

I have a php routine to read in a file to update about 57,000 records on a price list database. This works but can take more than 2 minutes so I've been looking for a way to display progress on the screen.

 

Before the main loop is set:-

 

@apache_setenv('no-gzip', 1);

@ini_set('zlib.output_compression', 0);

@ini_set('implicit_flush', 1);

 

and at the end of each iteration I've got:

 

        $percentdone = round($_SESSION['linecount'] / $target * 100 , 2);

        echo "<script type=\"text/javascript\">document.getElementById('disp').innerHTML=\"$partnumber - $partdescription. " . number_format($percentdone, 2) . "% completed.\";</script>";

 

Although this creates a very large html file, it works very well and does not slow the process down too much.

However, it leaves the screen totally blank in IE9 until the process is finished and as my users only use IE6(?) this is a problem.

 

The only clue I have at the moment is the Platform, which IE reports as Win64 and all others seem to report Win32.

 

Other than getting the users to use Chrome, any suggestions, please?

 

Link to comment
https://forums.phpfreaks.com/topic/243456-making-progress/
Share on other sites

Here's another method which should work on most browsers (inc IE6):

 

Launch the process by using an ajax call so that the page doesn't hang until complete and you still have full control over the page with javascript. When the processis launched, and as it progresses, keep updating the progress percent in a database or flat file. On complete have it echo out a status message e.g. 'success' or 'fail'.

 

Then, have a seperate ajax call which goes to a different script to lookup the progress in the database or flat file, you can then update a progess bar or percentage text using the response of the ajax call. Have this call on a timer so that it checks the progess every 10 sec or whatever.

 

When the first ajax call finishes, check the status and report it on your page, or if the progress check ajax call reports complete then display on the page and stop the timer.

 

If there will be multiple users at the same time you'll need a unique ID to deferentiate between seperate progess data in the database.

Link to comment
https://forums.phpfreaks.com/topic/243456-making-progress/#findComment-1250122
Share on other sites

Unfortunately since the beginning of browsers, IE has seemingly done its own thing and often behaves differently to the other main browsers. Even IE6 will happily handle Ajax though, especially using the jQuery framework which is geared towards cross browser compatibility.

Link to comment
https://forums.phpfreaks.com/topic/243456-making-progress/#findComment-1250183
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.