Little update: That code worked great for an email summary to a group of managers.
Here's my next challenge, which is a continuation of the first part - My company works with support tickets (a.ka. work orders) - each ticket has detail(s) (the results from my query) attached to it. So for example, I have 5 results from my query above. Three of those details are refer to ticket 1 and the other two details refer to ticket 2. I need to loop through the results and mail out a notice to the staff email on the ticket - assume different emails on each ticket.
The results should echo this:
Ticket#1
->Detail1
->Detail2
->Detail3
--mail ticket & detail to staff#1
Ticket#2
->Detail4
->Detail5
--mail ticket & detail to staff#2
So I understand I will need a couple of loops, but I'm a little unsure how to structure the loops so that each detail groups itself into each ticket.
I have adjusted my query to GROUP BY ticket # but I still can't seem to get my head wrapped around how to build the loops.
Can anyone give me a nudge in the right direction please?