Hi!
I need help with sending html email with all the records from two tables. I tried joint tables but it doesnt work as it should... Here is what i have
session_start();
if(!@$_SESSION["UserID"])
{
header("Location: login.php");
return;
}
?>
<?php
$con=mysqli_connect("...");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT add_delete_record.content, handover.shipment_type FROM add_delete_record, handover ");
$body .= "<html><head>
<style type='text/css'>
table.email {
background-color: white;
font-size:10px;
font-family:Arial;
}
table.email td {
border-width: 1px;
padding: 5px;
border-style: inset;
border-color: #cccccc;
background-color: white;
-moz-border-radius: ;
}
table.email th {
border-width: 1px;
padding: 5px;
border-style: inset;
border-color: #cccccc;
border-bottom:none;
background-color: #f0f0f0;
-moz-border-radius: ;
}
</style>
</head><body>
<p align='center' ><font style='font-size:25px;'>HANDOVER<hr /></font></p><br />";
while($row = mysqli_fetch_array($result))
$body .= "<li>" . $row['content'] . "</li>";
$body .= "<table border='0' cellpadding='0' cellspacing='0' class='email'><thead>
<tr>
<th>Shipment Type</th>
</tr></thead>";
$body .= "<tbody><tr><td>" . $row['shipment_type'] . "</td></tr>";
$body .= "</tbody></table></body></html>";
$to = "email@email.com";
$subject = 'Handover';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$body,$headers);
mysqli_close($con);
If i want to send all records from one table, it works fine, but selecting records from two tables is a problem.
Any ideas?
Thank you!