...

View Full Version : php and email



alex57
03-05-2007, 10:23 AM
mysql_connect("mysql10.powweb.com", "", "") or die(mysql_error());
mysql_select_db("info") or die(mysql_error());

$result2 = mysql_query("SELECT team.TeamName, team.TeamID, League.LeagueID, League.Totalpts, SUM(selectedfootballerscore.TeamWeeklyScore), users.username FROM team, League, users, selectedfootballerscore WHERE (League.TeamID = team.TeamID) AND (selectedfootballerscore.TeamID = team.TeamID) AND (users.UserID = team.UserID) AND (League.LeagueID = '$LID') GROUP BY Totalpts");

echo "<table border=1><tr><td><font size=1 face='Verdana'>Team Name</font></td><td><font size=1 face='Verdana'>Manager</font></td><td><font size=1 face='Verdana'>Weekly Pts</font></td><td><font size=1 face='Verdana'>Total Pts</font></td><td></td></tr>";

while ($row2 = mysql_fetch_array($result2))
{
$messagept2 = "<tr><td><font size=1 face='Verdana'>" . $row2['TeamName'] . "</font></td><td><font size=1 face='Verdana'>" . $row2['username'] . "</font></td><td><font size=1 face='Verdana'>" . $row2['SUM(selectedfootballerscore.TeamWeeklyScore)'] . "</font></td><td><font size=1 face='Verdana'>" . $row2['Totalpts'] . "</font></td></tr>";
}
echo "</table>";


I have the code above where data is being read out of a database and put into an html table. I want to ultimately send the data in the table as html in and email. How can this be done? Below is what I currently have. I can sned html using an extra header, but this wnt allow php to be sent.

thanks


$subject = $_POST['subject'];
$message = "hello there, this is an email";
$to = "alextrebsy57@hotmail.com";
$mailsend = mail($to,$subject,$message);

Inigoesdr
03-05-2007, 12:19 PM
mysql_connect("mysql10.powweb.com", "", "") or die(mysql_error());
mysql_select_db("info") or die(mysql_error());

$result2 = mysql_query("SELECT team.TeamName, team.TeamID, League.LeagueID, League.Totalpts, SUM(selectedfootballerscore.TeamWeeklyScore), users.username FROM team, League, users, selectedfootballerscore WHERE (League.TeamID = team.TeamID) AND (selectedfootballerscore.TeamID = team.TeamID) AND (users.UserID = team.UserID) AND (League.LeagueID = '$LID') GROUP BY Totalpts");

$data = "<table border=1><tr><td><font size=1 face='Verdana'>Team Name</font></td><td><font size=1 face='Verdana'>Manager</font></td><td><font size=1 face='Verdana'>Weekly Pts</font></td><td><font size=1 face='Verdana'>Total Pts</font></td><td></td></tr>";

while ($row2 = mysql_fetch_array($result2))
{
$data .= "<tr><td><font size=1 face='Verdana'>" . $row2['TeamName'] . "</font></td><td><font size=1 face='Verdana'>" . $row2['username'] . "</font></td><td><font size=1 face='Verdana'>" . $row2['SUM(selectedfootballerscore.TeamWeeklyScore)'] . "</font></td><td><font size=1 face='Verdana'>" . $row2['Totalpts'] . "</font></td></tr>";
}
$data .= "</table>";



$subject = $_POST['subject'];
$message = "hello there, this is an email" . $data;
$to = "alextrebsy57@hotmail.com";
$mailsend = mail($to,$subject,$message);

Something like that ^



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum