PHP Classes

HTML table with Database information in Body

Recommend this page to a friend!

      Mail  >  All threads  >  HTML table with Database information...  >  (Un) Subscribe thread alerts  
Subject:HTML table with Database information...
Summary:email
Messages:1
Author:Ronak Jain
Date:2013-01-21 10:07:39
 

  1. HTML table with Database information...   Reply   Report abuse  
Picture of Ronak Jain Ronak Jain - 2013-01-21 10:07:39
Hi,
i want to display the database information through the mail to the users for that i am getting the information in individual entries. i need one header under that all the database information.
i have uploaded the image of the email.

any help ?
I am not able to figure out the exact problem.

Code
<?php
$query = "SELECT emailid FROM users WHERE members='{$_SESSION['members']}'";
$result1 = mysql_query($query) or die(mysql_error());
$data1 = mysql_fetch_assoc($result1);
$email = $data1['emailid'];


$sql="SELECT sitelist.sno, sitelist.code, sitelist.sitename, sitelist.taluk, sitelist.district, sitelist.members, Junevisit.visitdate, Julyvisit.visitdate2, Augustvisit.avisitdate, Septvisit.svisitdate, Octvisit.ovisitdate, Novvisit.nvisitdate, Decvisit.dvisitdate, Jan13visit.j13visitdate
FROM sitelist
INNER JOIN Junevisit
ON sitelist.code=Junevisit.code
INNER JOIN Julyvisit
ON sitelist.code=Julyvisit.code
INNER JOIN Augustvisit
ON sitelist.code=Augustvisit.code
INNER JOIN Septvisit
ON sitelist.code=Septvisit.code
INNER JOIN Octvisit
ON sitelist.code=Octvisit.code
INNER JOIN Novvisit
ON sitelist.code=Novvisit.code
INNER JOIN Decvisit
ON sitelist.code=Decvisit.code
INNER JOIN Jan13visit
ON sitelist.code=Jan13visit.code
WHERE sitelist.members='{$_SESSION['members']}' OR sitelist.DC='{$_SESSION['members']}' ORDER BY sitelist.members ASC, sitelist.taluk ASC ";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){

$to = "$email1, [email protected]";
$subject = "xyz";

$message .="
<table width=\"100%\">
<tr>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>Sl.No</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>Site code</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>Site_Name</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>Taluk</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>District</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>DC/SE</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>August Visit</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>September Visit</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>October Visit</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>November Visit</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>December Visit</strong></th>
<th bgcolor=\"#0099FF\"><font color=\"white\"><strong>January.13 Visit</strong></th>
</tr>";





"<tr>
<td><font size=\"1px\">" . $rows['sno'] . "</td>
<td><font size=\"1px\">" . $rows['code'] . "</td>
<td><font size=\"1px\">" . $rows['sitename'] . "</td>
<td><font size=\"1px\">" . $rows['taluk'] . "</td>
<td><font size=\"1px\">" . $rows['district'] . "</td>
<td><font size=\"1px\">" . $rows['members'] . "</td>
<td><font size=\"1px\">" . $rows['avisitdate'] . "</td>
<td><font size=\"1px\">" . $rows['svisitdate'] . "</td>
<td><font size=\"1px\">" . $rows['ovisitdate'] . "</td>
<td><font size=\"1px\">" . $rows['nvisitdate'] . "</td>
<td><font size=\"1px\">" . $rows['dvisitdate'] . "</td>
<td><font size=\"1px\">" . $rows['j13visitdate'] . "</td>

</tr>
</table>
";

}



// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

mail($to,$subject,$message,$headers);
?>