Jump to content

Recommended Posts

I have a MYSQL query that pulls appointment data from my database and sends an email to the people who have appointments.  However, if there are several appointments for one person each appointment is sent in a different email.  How do I get for each user with several appointments one email sent with all appointments in the single email.

 

$rsnotifier = mysql_query($query_notifier, $database);
while($row_rsnotifier = mysql_fetch_assoc($rsnotifier))
{
$email_address = $row_rsnotifier["email_address"];
$subject = "Appointment Reminder";
$message = 
"<html>
<head>
<title>My Calendar Appointment</title>
</head>
<body background='http://www.name.com/images/bkrnd.jpg'>
<?php do { ?>
<div>Hello,<br> Its time for {$row_rsnotifier['appdesc']} - {$row_rsnotifier['follow_up_date']}</div>
<?php
}
while ($row_rsnotifier = mysql_fetch_assoc($rsnotifier));?>
</body>
</html>";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = 'From: My Appointment Reminder <admin@name.com>' . "\r\n";

You would need to adjust your query ($query_notifier, which isn't shown to us) and test for num_rows of multiple appointments. It would be handy to undertsand the schema of your table that holds the appointments. Anyways, if num_rows ends up > 1, you would do a loop to pull all the appts for that client. Easy to do, but we need more information to give you more detailed options.

 

PhREEEk

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.