Jump to content

Archived

This topic is now archived and is closed to further replies.

TEENFRONT

echoing ... Done

Recommended Posts

Hey

i have a mail script ( standard mail() ) it sends to a few hundred members ( not spam ) I loop through each row grabbing useremail and mailing it.

I tried echoing $email Sent <br /> for each loop.. but it just loaded the page in one big go...how to i get it to echo something each time a row has been looped and the mail has been sent? Cheers!

Share this post


Link to post
Share on other sites
i dont know if it is possable to count throw the loop while processing i looked it up on google no luck.

It's very intreasting quistion.

mysql_num_rows only shows the current count for all so how do you count the processing of the loop?

for example the user wants to count and echo the emails that are passing throw the loop but i dont seem to have any information on counting the process of the loop as it loops?

Share this post


Link to post
Share on other sites
You can do it with Javascript and the DOM, it's not something that PHP can do it on it's own... PHP is a preprocessing language (IE: It processes before the server is finished)

You could add a javascript line to your code that calls a function, say, email()... then it might look like this:
[code]
function email(email, username)
{
var myVar = document.getElementById("email");
var txt = document.createTextNode("Successfully emailed " + username + " at the email " + email + "!");
myVar.appendChild(txt);
}
[/code]

Then have:

<div id="email"></div> in your HTML and it should show up there. I'm somewhat new to javascript, but if you look up Javascript, the DOM, and appendChild() you'll find what you need.

Lastly in you're PHP code just call the function, giving it the username and email in your while loop.. so at the end of the loop after the email has been sent do the following:

echo "email(".$email.",".$username.");";

that should call email(email, username); and start the function.

Share this post


Link to post
Share on other sites
lets get this stright becouse php is processing the information of the loop then that information can only bee seen with javasript as the loop is now only viewable client side?

thanks.

Share this post


Link to post
Share on other sites
Hmm, you know that might not even work because the entire while loop will be finished by the time the page loads, so you wont see things appear on screen you'll just see them on there already. The only way to do this may be through AJAX.

Share this post


Link to post
Share on other sites
it will work with javascript but i think you might have to use sleep() also.

Share this post


Link to post
Share on other sites
the code i am provideing will only count the submitting emails but works grate.


sorry your have to alter the code as you need it but a good start.



ok got it all going good luck.

you have to copy and past from the link ok.

The forum didnt let me post it here ok.

http://freesingles.ath.cx/email.inc


any comments welcomed.

Share this post


Link to post
Share on other sites

×

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.