Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 33

Thread: Send Me An Email Of Birthdays

  1. #21
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Any ideas about this one?

  2. #22
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Well, it should be

    Code:
    \r\n
    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:
    $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.' 
    ';
    Notice the spaces between the lines. Hope this helps.

    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

  3. #23
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?

  4. #24
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Try replacing this line:

    Code:
    $bdays .= 'Name: '.$qry['Name'].' ('.$qry['birthday'].') \r\n';
    with this:

    Code:
    $bdays .= <<<HERE
    Name: $qry['Name'] ($qry['birthday'])
    
    HERE;
    That should do it. Hope this helps.
    "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

  5. #25
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hmmmm new error is this...

    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
    Any ideas?

  6. #26
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    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

  7. #27
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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);
    }
    ?>

  8. #28
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    on this line:
    Code:
    $bdays .= 'Name: '.$qry['FirstName'].' '.$qry['LastName'].' ('.$qry['DateOfBirth'].') '.$qry['Email'].' \r\n';
    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.
    "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

  9. #29
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

  10. #30
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Try replacing the while loop:

    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';
          }
      }
    with this:
    Code:
      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"].' 
    ';
          }
       }
    Not tested, but should work. Hope this helps
    "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

Posting Permissions

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