Hi all. I have a simple form pulling emails from a database which is using the PHP mail feature to send e-mails out to a mailing list.
The e-mails are in the table "members" and the field is called "email". So, I have the following PHP script:
<?php
$subject = $POST['subject'];
$message = $POST['message'];
$x = 1;
$hold = 50; //quantity of emails sent before 3 sec delay
$emails = mysql_query("SELECT email FROM members");
while ($sendemail = mysql_fetch_array($emails)) {
$email = $sendemail["email"];
mail($email, $subject, $message, "From: Mark <mark@stonereader.net>");
$x++;
if($x == hold) { //when $x is equal to $hold, a 3 sec delay will occur to avoid timeout
sleep(3);
$x = 0;
}
} //end of while loop
?>
But I keep getting this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in line 11, line 11 being this line:
while ($sendemail = mysql_fetch_array($emails)) {
Any reason why this argument is invalid? Help, I'm almost there!