Hi
I have been playing with this code to send soccer results to members who have signed up to recieve them. However no emails are being sent out.
Here is my code
<?
include("../../app_global.php");
//open the connection
$conn = mysql_connect("$glob_host", "$glob_user", "$glob_pass");
//pick the database to use
mysql_select_db($db_name, $conn);
//sql to get all the latest results from the games table
$sql = "SELECT team1, team2, team1_result, team2_result, game_id, DATE_FORMAT(game_date,'%D %M %Y') as 'datey'
FROM dcass_games
WHERE team1_result != 'tbc'
AND team2_result != 'tbc'";
$result = mysql_query($sql, $conn)or die(mysql_error());
$display_block = "";
$count=0;
//will go through each row in the result set and display data
while ($row = mysql_fetch_array($result)) {
//give a name to the fields
$game_id=$row['game_id'];
$group = $row['group'];
$tournament = $row['tournment'];
$game_date=$row['datey'];
$venue=$row['venue'];
$team1=$row['team1'];
$team2=$row['team2'];
$team1_result=$row['team1_result'];
$team2_result=$row['team2_result'];
$game_id = $row['game_id'];
$display_block .="<table width=\"450\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"content\"><tr><td colspan=\"4\" >$game_date</td></tr><tr><td width=\"200\">$team1</td><td><strong>$team1_result</strong></td><td><strong>$team2_result</strong></td><td width=\"200\">$team2</td></tr><tr><td colspan=\"4\" height=\"10\"></td></tr></table>";
}
// now to select all the punters from the my-members table who want to recieve the results
$sql = "SELECT *
FROM my_members
WHERE dcass = 'on'";
$result2 = mysql_query($sql, $conn)or die(mysql_error());
while ($row = mysql_fetch_array($result2)) {
//give a name to the fields
$fullname=$row['fullname'];
$email=$row['email'];
//print "$email";
//mail stuff
$msg = "
DCASS Results to your Inbox
Hello $fullname
Here are the Latest DCASS Results
$display_block
";
$mailto = "$email";
$mailfrom = "info@brightwater";
$subject = "DCASS Results";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: [email]postmaster@9thsquare.com[/email]\n";
mail($email, $mailfrom, $subject, $msg, $headers);
$display_block2 .="The Football results have been sent to $email<br>";
//end mail stuff
}
?>
Is there a problem with my loop ??
Thanks in advance