drranch Posted January 1, 2008 Share Posted January 1, 2008 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"; Quote Link to comment https://forums.phpfreaks.com/topic/83938-sending-database-results-in-an-email-help-needed/ Share on other sites More sharing options...
PHP_PhREEEk Posted January 1, 2008 Share Posted January 1, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/83938-sending-database-results-in-an-email-help-needed/#findComment-427181 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.