Robbie
20-01-2008, 08:52 PM
Hmm,
Why does this send the emails more than once, sometimes twice, four times, six times?
if ($_POST[send]) {
$email = $_POST["msg"];
$query = "SELECT * FROM `emailaddresses` ";
$result = mysql_query($query) or die (mysql_error()."<br />Couldn't execute query: $query");
$numrows = mysql_num_rows($result);
while($row = mysql_fetch_array($result)) {
$subject = 'Email';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($row[email], $subject, 'Test message', $headers);
}
}
Thats just the send email part.
Any help please?
Thanks
Why does this send the emails more than once, sometimes twice, four times, six times?
if ($_POST[send]) {
$email = $_POST["msg"];
$query = "SELECT * FROM `emailaddresses` ";
$result = mysql_query($query) or die (mysql_error()."<br />Couldn't execute query: $query");
$numrows = mysql_num_rows($result);
while($row = mysql_fetch_array($result)) {
$subject = 'Email';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($row[email], $subject, 'Test message', $headers);
}
}
Thats just the send email part.
Any help please?
Thanks