...

View Full Version : emailing chunk of HTML from mySQL database



sweenster
06-13-2005, 09:24 PM
I'm trying to read a chunk of HTML from a record in a mySQL database and email it using PHP's mail function.

My code is a bit on the complex side (which is why i've not posted it) but it reads from the database fine and when it goes to email the data (using PHP's mail() command) it responds with error:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/sites/site165/web/fstudent/html/newsm2f.php on line 55

I imagine I would need to parse the SQL entry first.

Any ideas on how to do this? :-)

sweenster
06-13-2005, 09:27 PM
... actually the code isn't that bad (i've slimmed it down a bit)...



$query = "SELECT * FROM fs_news WHERE id='".$id."'";

if ($mysql_result = mysql_query($query, $linkdb)) {
if (ExecuteQuery($linkdb, $result, $query)) {
while ($row = NextRow($result)) {
$mess2 = $row[3];
$subject = "News Article - ".$row[2];
}
}
}

$headers = "From: $yname <$yemail>\n" .
"To: $tname <$temail>\n" .
"Bcc: Admin <brian@sweenster.co.uk>\n";
$message = "This article was emailed to you from sweenster.co.uk by ".$yname." (".$yemail.").\n\n".$yname." says:\n".$msg."\n\n_____________________________________________________________";
$message .= "".$mess2.\n_____________________________________________________________" .
"\nhttp://www.sweenster.co.uk";

$ok = @mail($tmail, $subject, $message, $headers);
if ($ok) {
#print confirmation
print('<p class="bl"><strong>E-mail Sent Successfully!</strong></p>');
print('<a href="_index.php?page=news&cat='.$id.'&mlst=0&data='.$usmdata.'">Click to return to gallery</a>');
} else {
print('<script type="text/javascript">alert(\'An Error has occurred. Please Check and Try Again.\');');
print('history.back();</script>');
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum