Need to Flush before Sleep but I'm blank.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi All

I'm new to php and am converting a bunch of asp pages to php.

Current problem :

I am using a Submit button on a form to POST ( send the database variables )  
to a php page that will send a personalised e-mail to each client.

On the php page,
I am looping through a database,
compiling a message ( html format ),
and mailing the message to my client.

After the mail has been sent, I need to wait for 4 seconds before continuing  
with the next database record.

I am using this code after the mail has been sent :

      echo "Mail Sent to : " . $row['CliName'];

Problem is, that nothing appears after I click on the Submit button on the  
first page's form ( the first page just remains on the screen ). Once the  
database has been looped, the entire (correct) output appears on my screen -  
but I need to see some sort of progress as it works it's way through the  

Many Thanks in advance for any assistance

Re: Need to Flush before Sleep but I'm blank.

Dave wrote:
Quoted text here. Click to load it

Not the best decision architecturally (in a shared hosting environment,
this will hit the execution time limit pretty quickly; and if you
control the environment, this is something you want to do from the
command line), but let's assume you want to stick with it for the time

Quoted text here. Click to load it

So make something appear.  Say, write this before the loop:

echo "Preparing to send mail...";

You should also be aware that some Web servers will ignore PHP's
flushing instructions and continue to buffer the output.


Site Timeline