Hello,
I have a form which allows members of my team to update a particular table, upon updating I have php set to send an email to a certain address. What I'd like to include in this email is the table after it's been updated.
Here's what I'm currently using which isn't working:
[PHP]
<?php
$to = "user@domain.com";
$from = "user@domain.com";
$subject = "subject";
//
$message =
$connection = mysql_pconnect("localhost","username","pw") or die('Could not connect: ' . mysql_error());
mysql_select_db("status1_123TStatus", $connection) or die('Could not select database' . mysql_error());
// no problems so query the db
$SQL = "SELECT * FROM tbname;";
$result = mysql_query($SQL) or die('Query failed: ' . mysql_error());
$message = "$output";
$output = "<table border=\"1\">\n" .
"<tr>\n" .
"<td>Id</td>\n" .
"<td>service</td>\n" .
"<td>CurrentStatus</td>\n" .
"</tr>\n";
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$id = $row[0];
$service = $row[1];
$CurrentStatus = $row[2];
$output .= "\t<tr>\n" .
"\t\t<td>$id</td>\n" .
"\t\t<td>$service</td>\n" .
"\t\t<td>$CurrentStatus</td>\n" .
"\t</tr>\n";
}
$output .= "</table>\n";
mysql_free_result($result);
//
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$to = "$to";
mail($to, $subject, $message, $headers);
header("Refresh: 5; url=");
?>
[/PHP]
Anyone have an idea as to what I'm doing wrong here?? Please help!
Thanks!