Jump to content

echoing ... Done


TEENFRONT

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!
Link to comment
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?
Link to comment
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.
Link to comment
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.
Link to comment
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.