Any ideas about this one?
Any ideas about this one?
Well, it should be
If you wanted to put the <br> in it, then you would have to put in the MIME type for the email itself. Try this instead:Code:\r\n
Notice the spaces between the lines. Hope this helps.Code:$message = 'Below is a list of the members and their birthdays that are coming up in the next couple of weeks. \r\n'; $message .= 'The birthdays are as follows: '; $message .= '----------------------------------------- '; $message .= $bdays.' ';
or try something like this:
Code:$messages = <<<HERE Below is a list of the members and their birthdays that are coming up in the next couple of weeks. The birthdays are as follows: ----------------------------------------- $bdays HERE;
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Ah ok the first option didn't change anything, the second option did put the first 2 lines seperately but still displayed the birthdays all together... Any ideas?
Try replacing this line:
with this:Code:$bdays .= 'Name: '.$qry['Name'].' ('.$qry['birthday'].') \r\n';
That should do it. Hope this helps.Code:$bdays .= <<<HERE Name: $qry['Name'] ($qry['birthday']) HERE;
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Hmmmm new error is this...
Any ideas?Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in \emailBirthdays.php on line 24
PHP Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in \emailBirthdays.php on line 24
What's line around line 24? If it is the $bdays variable, try taking out the single quotes in the $qry variables to see if that is it. Either way, post the code so we can see what could be the cause of it.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Sorry only just saw this... Ok the whole page looks like this
PHP Code:<?php
$to = "email@mydomain.com"; //your email address
$subject = "Member's birthdays"; //subject of email
/* connect to the mysql database and use a query to get the members info */
include 'library/config.php';
include 'library/opendb.php';
$year = date('Y');
$month = date('m');
$results = mysql_query("SELECT * FROM `tblmembers` WHERE `DateOfBirth` LIKE '%$month%'");
if (mysql_num_rows($results) < 1) {
die('There are no members with birthdays this month');
}
else {
while ($qry = mysql_fetch_array($results)) {
if (strtotime($qry['DateOfBirth']) <= (time() + 86400*14)) {
$bdays .= 'Name: '.$qry['FirstName'].' '.$qry['LastName'].' ('.$qry['DateOfBirth'].') '.$qry['Email'].' \r\n';
}
}
$message = <<<HERE
Below is a list of the members and their birthdays that are coming up in the next couple of weeks.
The birthdays are as follows:
-----------------------------------------
$bdays
HERE;
}
$from = "From: PHP Script <noreply@mydomain.com";
{
mail($to, $subject, $message, $from);
}
?>
on this line:
Change to this:Code:$bdays .= 'Name: '.$qry['FirstName'].' '.$qry['LastName'].' ('.$qry['DateOfBirth'].') '.$qry['Email'].' \r\n';
That should take care of the error message you get. Hope this helps.Code:$bdays .= 'Name: '.$qry["FirstName"].' '.$qry["LastName"].' ('.$qry["DateOfBirth"].') '.$qry["Email"].' \r\n';
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Thanks that fixed the error, but it still just displays them all one after the other on one big line and shows the "\r\n", I was hoping to be able to get them, to display like and also with the DOB lookinbg like that below, it displays it like YYYY-MM-DD...
Name: John Smith (17-01-1980) johnsmith@domain.com
Thanks again!
Try replacing the while loop:
with this:Code:while ($qry = mysql_fetch_array($results)) { if (strtotime($qry['DateOfBirth']) <= (time() + 86400*14)) { $bdays .= 'Name: '.$qry['FirstName'].' '.$qry['LastName'].' ('.$qry['DateOfBirth'].') '.$qry['Email'].' \r\n'; } }
Not tested, but should work. Hope this helpsCode:while ($qry = mysql_fetch_array($results)) { if (strtotime($qry['DateOfBirth']) <= (time() + 86400*14)) { $bdays .= 'Name: '.$qry["FirstName"].' '.$qry["LastName"].' ('.date('d-m-Y', strtotime($qry["DateOfBirth"]).') '.$qry["Email"].' '; } }
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Bookmarks