Jump to content

sending database results in an email help needed


drranch

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 <[email protected]>' . "\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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.