<?php
$result = mysqli_query($con, "SELECT * FROM cse");
$mail_data = "";
while ($row = mysqli_fetch_array($result)) {
$Hallticket_No = $row['Hallticket No'];
$Name = $row['Name'];
$Email_ID = $row['Email-ID'];
$Jntu = mysqli_query($con, "SELECT * FROM `jntu_excelsheet` WHERE A ='$Hallticket_No'");
$mail_data = "<html>
<head></head> <body>
<table border='1'>
<tr>
<th>Hallticket No</th>
<th>Subject Code</th>
<th>Subject Name</th>
<th>Internal Marks</th>
<th>External Marks</th>
<th>Total Marks</th>
<th>Credits<th>
</tr>";
while ($x = mysqli_fetch_array($Jntu)) {
$A = $x['A'];
$B = $x['B'];
$C = $x['C'];
$D = $x['D'];
$E = $x['E'];
$F = $x['F'];
$G = $x['G'];
$mail_data = $mail_data . '<tr>';
$mail_data = $mail_data . '<td>' . $x['A'] . '</td>';
$mail_data = $mail_data . '<td>' . $x['B'] . '</td>';
$mail_data = $mail_data . '<td>' . $x['C'] . '</td>';
$mail_data = $mail_data . '<td>' . $x['D'] . '</td>';
$mail_data = $mail_data . '<td>' . $x['E'] . '</td>';
$mail_data = $mail_data . '<td>' . $x['F'] . '</td>';
$mail_data = $mail_data . '<td>' . $x['G'] . '</td>';
$mail_data = $mail_data . '</tr>';
}
$mail_data = $mail_data . "</table></body></html>";
// echo $mail_data;
$x = mail($Email_ID, "Exam Result", $mail_data);
if ($x) {
echo "<div style='color:red'>";
echo "mail sent..! " . "<i><span style='color:blue'>" . $Email_ID . "</span></i>";
echo "</div>";
} else {
echo "<div style='color:red'>";
echo "<br>email not sent To: " . "<b><span style='color:chocolate'>" . $Email_ID . "</span></b>";
echo "</div>";
}
}
?>
我想以如下表格格式发送结果:
Hallticket No Subject_Code Subject_Name Internal_Marks External_Marks Total_Marks Credits
xxx xxxx xxx xxx xxxxx xxx
yyyy yyyyy yyyy yyy yyyyy yyyy