Maybe I'm just having a brain cramp, but I can't seem to get this to work out.
I've got a simple script that creates a table, and sends it as an html mail out.
The trouble lies when I try to include a function that I've made up to actually create the table.
This function creates an html table from any mysql query you pass it, along with the number of columns the query pulls.
I can't seem to get that function to echo out as part of the actual message body.
I'm sure it's just a syntax thing, and my brain is fried on a Friday. Any help is appreciated.
Thanks.
<?php
include("/var/www/xxx/includes/connect.inc");
include("/var/www/xxx/reports/ddtable.php");
$query = "
SELECT count( cu_number ) ... ";
$date=date("m-d-y");
$table=DDTable($query, 2); //make the table the body of the email
$to = "xxx@xxx"; //set who it's going to
$subject = "(test) Top Call-Ins - $date";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: top-offenders@xxx' . "\r\n";
$headers .= 'Reply-To: do-not-reply@xxx' . "\r\n";
$config= "-f top-offenders@xxx";
$body = "
<html>
<body>
<h3>Top Call Ins by Customer number - $date</h3>
$table
</body>
</html>";
mail($to, $subject, $body, $headers, $config);
echo "mail sent.";
mysql_close($conn);
?>