Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

HTML table with Database information in Body

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

HTML table with Database information in Body

Postby jainuttam » Mon Jan 21, 2013 1:15 am

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, xyz@xyz.com";
$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);
?>
jainuttam
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Jan 19, 2013 2:05 am

Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron