Hi all, i have a piece of code that selects some data from a database and displays the results in a table. I am trying to edit the code to allow me to email the table to a an address entered, but am having difficulties, can anyone offer any advice?
This is my code that i am trying to fix;
if(isset($_POST['send'])) {
$subject = "Data";
$query = "SELECT * From database
ORDER by columnA";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$A = $row['A'];
$B = $row['B'];
$C = $row['C'];
$body = "";
}
$email = $_POST['email'];
if (mail($email, $subject, $body)) {
echo("<p>successfully sent</p>");
}
else {
echo("<p>delivery failed...</p>");
}
}
I tried to write out the table code in $body, but don't get the desired results. Any help would be greatly appreciated.