Potatis Posted January 28, 2008 Share Posted January 28, 2008 Hello, I'm having trouble getting a URL to display in emails without breaking the loop. When an admin processes the answers to questions at the end of the week, I want an email to be sent to each user to notify them that the answers have been processed. This works fine if the email body doesn't have a URL in the body, but if it does have the URL, only the first person in the database recieves the email. It is perfectly formatted with an active URL. No problem with that email. But subsequent emails are not sent. Here is the code: //Send Email $subject = "Subject"; $headers = "FROM: admin@address.com\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: multipart/alternative;\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 7bit"; $headers .= "\r\n"; $sql = mysql_query("SELECT * FROM games WHERE round='$round'") or die(mysql_error()); $i = 0; while ($rw = mysql_fetch_assoc($sql)) { if ($i == 20) { sleep(1); $i = 0; } $message ="Hello " . $rw['username'] . ",\n\n" . "Your answers have been processed, please visit http://www.example.com/ to see how you fared against everyone else! \n\n" . "Admin"; $to = $rw['email']; mail($to, $subject, $message, $headers); $i++; } mysql_free_result($sql); As I said, without the URL it is fine, but I'd rather have a link that people can click on to quickly see their scores. Quote Link to comment https://forums.phpfreaks.com/topic/88120-url-breaking-while-loop/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.