Please help -I have now searched for days for an answer to this!
I am attempting to query a database and send the results in table format via email (so I assume in HTML). I can query the table correctly and display the information but how do I now send it - if at all possible???
So far:
Thanks in anticipation!
I am attempting to query a database and send the results in table format via email (so I assume in HTML). I can query the table correctly and display the information but how do I now send it - if at all possible???
So far:
Code:
<?php
$con = mysql_connect("*****","*****","*****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("*****", $con);
$result = mysql_query("SELECT * FROM contactdetails");
echo "<table border='1'>
<tr>
<th>Name:</th>
<th>Surname:</th>
<th>Number:</th>
<th>Email:</th>
<th>Moving From:</th>
<th>Moving To:</th>
<th>Date:</th>
</tr>";
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Surname'] . "</td>";
echo "<td>" . $row['Number'] . "</td>";
echo "<td>" . $row['Email'] . "</td>";
echo "<td>" . $row['MovingFrom'] . "</td>";
echo "<td>" . $row['MovingTo'] . "</td>";
echo "<td>" . $row['Date'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
Comment