Jump to content


Photo

echoing ... Done


  • Please log in to reply
6 replies to this topic

#1 TEENFRONT

TEENFRONT
  • Members
  • PipPipPip
  • Advanced Member
  • 338 posts

Posted 07 October 2006 - 02:59 PM

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!
Teenfront.co.uk : Free Teen Chat -  FunkySmileys.co.uk : MSN Smileys -  ArcadeMonkey.co.uk : Free Flash Games
8Baller.co.uk : Free Multiplayer Pool [url=http://8Baller.co.uk]

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 07 October 2006 - 03:25 PM

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?
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 tleisher

tleisher
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 07 October 2006 - 03:30 PM

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:
function email(email, username)
{
	var myVar = document.getElementById("email");
	var txt = document.createTextNode("Successfully emailed " + username + " at the email " + email + "!");
	myVar.appendChild(txt);
}

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.


#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 07 October 2006 - 03:34 PM

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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 tleisher

tleisher
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 07 October 2006 - 03:37 PM

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.

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 07 October 2006 - 03:41 PM

it will work with javascript but i think you might have to use sleep() also.

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 07 October 2006 - 03:53 PM

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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users