Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: php and email

  1. #1
    Regular Coder
    Join Date
    Sep 2006
    Posts
    216
    Thanks
    9
    Thanked 0 Times in 0 Posts

    php and email

    Hello,

    I am sending emails using the code below:

    PHP Code:
    $subject $_POST['subject'];
    $message "hello there, this is an email";
    $to "alextrebsy57@hotmail.com";
    $mailsend mail($to,$subject,$message); 
    I have data from a database and want to send this in my email so it is displayed as in an html table in the email. I cannot get this to work as when I assign the html to the $message variable, the html doesnt render in the email, it only prints out the html.

    Can anybody help please.

    Thanks

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,011
    Thanks
    2
    Thanked 312 Times in 304 Posts
    Check Example 1050 at this link - http://www.php.net/manual/en/function.mail.php
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    Regular Coder
    Join Date
    Sep 2006
    Posts
    216
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thats great thanks, however my code is like this:

    PHP Code:
    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>"
    so basically data is read out of a database into an html table. This is the table I need to send. Are their hearders to send PHP? Can i save the results of my SQL query in an html table and just send it as an html table?

    thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •