Can anyone help me with this code, I was just emailing text but it’s becoming quit messy so thought I’d try and send it as a HTML, I have been able to format it and I can get a result from the top of the page, but how do I combine that with all my php & SQL Query?
[code=php]<?php
mail(‘[email protected]’, ‘Subject’,
‘<html><body><p>Your <i>message</i> here.</p></body></html>’,
“To: The Receiver <[email protected]>n” .
“From: The Sender <[email protected]>n” .
“MIME-Version: 1.0n” .
“Content-type: text/html; charset=iso-8859-1”);
/* connect to the mysql database and use a query to get the members info */
include ‘library/config.php’;
include ‘library/opendb.php’;
$p = explode ( ‘ ‘, date(‘m Y’) );
if ($p[0] == 1) {
$Month = 12;
$theYear = $p[1]-1;
}
else {
$Month = $p[0]-1;
$theYear = $p[1];
}
if ($Month < 10) {
$theMonth = ‘0’.$Month;
}
else {
$theMonth = $Month;
}
//$results = mysql_query(“SELECT * FROM `tblmembers` WHERE `memberApproved` = ‘P'”);
$results = mysql_query(“SELECT tblmembers.*, tblrepresentatives.rep_Firstname,tblrepresentatives.rep_Lastname FROM tblmembers LEFT JOIN tblrepresentatives ON (tblmembers.rep_NBR = tblrepresentatives.rep_NBR) WHERE tblmembers.memberApproved = ‘P'”);
if (mysql_num_rows($results) < 1) {
die(‘No members were approved last month’);
}
else {
while ($qry = mysql_fetch_array($results)) {
if (strtotime($qry[‘loginDateTime’]) <= (time() + 86400*31)) {
$login .= ‘<b> Name </b>’ .$qry[“FirstName”].’ ‘.$qry[“LastName”].’
Application Date:’.date(“d/m/Y”, strtotime($qry[“JoinDate”])).’ ‘.$qry[“Email”].’ ‘.$qry[“rep_Firstname”].’ ‘.$qry[“rep_Lastname”].’ (‘.$qry[“State”].’)
——————–
‘;
}
}
$message = <<<HERE
The login information is as follows:
—————————————–
$login
HERE;
$from = “<[email protected]>”;
mail($to, $subject, $message, ‘From: ‘.$from);
}
?>