outputing progress during a longish php routine... 
Author Message
 outputing progress during a longish php routine...

Folks,

I have a loop in my PHP code that is used to process form data... sometimes,
it can take time to chew the data... I would like to inform the user which
record is being processed as it does its thing... I've tried using
ob_flush(); but that doesn't do it... I am pretty sure I'm on the right
track though... Basically, at the moment, when I click submit, I wait ten
seconds before my end result/output appears... how can I instead give an
update every second or two saying "Processing record $x"...

thanks for all help...

randelld



Sun, 31 Jul 2005 08:32:26 GMT  
 outputing progress during a longish php routine...


Quote:

> Folks,

> I have a loop in my PHP code that is used to process form data...
sometimes,
> it can take time to chew the data... I would like to inform the user which
> record is being processed as it does its thing... I've tried using
> ob_flush(); but that doesn't do it... I am pretty sure I'm on the right
> track though... Basically, at the moment, when I click submit, I wait ten
> seconds before my end result/output appears... how can I instead give an
> update every second or two saying "Processing record $x"...

> thanks for all help...

> randelld

I'd suggest you use javascript to alter the contents of an html object.

something like:
echo "
<html>
<head>
 <title>blah blah blah</title>
</head>

<body>
<table>
    <tr>
        <td>Process Name</td>
    </tr>
    <tr>
        <td id="statuslbl"></td>
    </tr>
</table>
</body>
</html>";

flush();

loop control {
    do stuff;
<script language=JavaScript>
    document.getElementByID("statuslbl").innerHTML = "Processing record $x";
</script>
    flush();
    $x++;

Quote:
}

just keep outputting this followed by flush at the end of iteration and it
should work.
NB instead of using the innerHTML you could just use a text field and set
the value.

Hope this helps



Sun, 31 Jul 2005 17:16:45 GMT  
 outputing progress during a longish php routine...


Quote:



> > Folks,

> > I have a loop in my PHP code that is used to process form data...
> sometimes,
> > it can take time to chew the data... I would like to inform the user
which
> > record is being processed as it does its thing... I've tried using
> > ob_flush(); but that doesn't do it... I am pretty sure I'm on the right
> > track though... Basically, at the moment, when I click submit, I wait
ten
> > seconds before my end result/output appears... how can I instead give an
> > update every second or two saying "Processing record $x"...

> > thanks for all help...

> > randelld

> I'd suggest you use javascript to alter the contents of an html object.

> something like:
> echo "
> <html>
> <head>
>  <title>blah blah blah</title>
> </head>

> <body>
> <table>
>     <tr>
>         <td>Process Name</td>
>     </tr>
>     <tr>
>         <td id="statuslbl"></td>
>     </tr>
> </table>
> </body>
> </html>";

> flush();

> loop control {
>     do stuff;
> <script language=JavaScript>
>     document.getElementByID("statuslbl").innerHTML = "Processing record
$x";
> </script>
>     flush();
>     $x++;
> }

> just keep outputting this followed by flush at the end of iteration and it
> should work.
> NB instead of using the innerHTML you could just use a text field and set
> the value.

> Hope this helps

Thanks... I'll give that a try...


Wed, 03 Aug 2005 06:06:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Progress during BUILD()

2. showing download progress with php

3. Why does Error 8 pop up during routine datalogging

4. int during rep somestring routine

5. PHP error check routine problem.

6. outputing a dir listing for use as a file sorter

7. error 10843 - underflow error - PCI 6025E - when outputing two waveforms simultaneously

8. INPUTING/OUTPUTING DATA IN PCLOGO OR MICROWORLDS????

9. Outputing 32 bit, 16 bit numbers to a socket (scm)

10. Outputing State Bits

11. Outputing data

12. Outputing signals down the hiearchy........

 

 
Powered by phpBB® Forum Software