I have a problem I just can't figure out.
I have a contact managment system that has a "client" table with a FirstName, LastName, and DateOfBirth. On the same record I could have a SpouseName with a SpouseDateOfBirth.
My client requires to be able to pull up all birthdays being either a main client or the spouse, but needs the Name of the one with the birthday to show up in this mail merge spread sheet I generate.
So part of my MySQL WHERE clause is:
AND ((MONTH(DateOfBirth) >= $DOBFrom AND MONTH(DateOfBirth) <= $DOBTo) OR (MONTH(SpouseDateOfBirth) >= $DOBFrom AND MONTH(SpouseDateOfBirth) <= $DOBTo))
And this will pull up all birthdays in the given month range they desire. Now my problem is as I loop over the recordset I need some PHP code I assume to tell if is the main person's birthday it found on that record or the spouses birthday so I can place the correct name in the "name" field in the mail merge sheet I generate.
Does anyone have any ideas? I am really stuck and my client thinks this should be simple to do.
Thanks