I have two mysql tables (course & student) with courseID in both of them. In table course there is another (text) field called course_name that identifies whether the course is firsttime or renewal. That is, its value is either "firsttime" or "renewal". In table student I have a second field called email and a third field called reg_date (with a date in it).
I need to query table student to get the emails with a date - 3 days from today - and send them a reminder message using send mail. However, the message (msg1 or msg2) to be sent depends on whether it is first_time or renewal course, hence, necessitating the joining of the tables. Joining the tables would enable finding which course it firsttime and which one renewal to send the message accordingly. How would I do the join and loop using these table names and fields?
Your input is deeply appreciated.