phpmailer
Posted: Sat Jun 09, 2007 9:50 am
I am trying to use this to create a mailing list. I am running into an issue with the line I get an error of Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/m/a/l/malikhaynes/html/mailtestmaillist2.php on line 13.
Here is the full code you guys to see:
Any help would be great!
Code: Select all
while ($row = mysql_fetch_array($result))Here is the full code you guys to see:
Code: Select all
<?php
// Grab our config settings
require_once($_SERVER['DOCUMENT_ROOT'].'/config.php');
// Grab the FreakMailer class
require_once($_SERVER['DOCUMENT_ROOT'].'/lib/MailClass.inc');
@MYSQL_CONNECT("localhost","root","1234");
@mysql_select_db("database");
$query = "SELECT FirstName, Email, FROM users WHERE id=$id";
$result = @MYSQL_QUERY($query);
while ($row = mysql_fetch_array($result))
{
$mailer = new FreakMailer();
// HTML body
$body = "Hello <font size=\"4\">" . $row["FirstName"] . "</font>, <p>";
$body .= "<i>Your</i> personal photograph to this message.<p>";
$body .= "Sincerely, <br>";
$body .= "PHPMailer List manager";
// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $row["FirstName"] . ", \n\n";
$text_body .= "Your personal photograph to this message.\n\n";
$text_body .= "Sincerely, \n";
$text_body .= "PHPMailer List manager";
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($row["email"], $row["FirstName"]);
if(!$mail->Send())
echo "There has been a mail error sending to " . $row["email"] . "<br>";
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
}
?>