= '$nextmonday' and "; $query .= "(SR_reservation.Status='1' or SR_reservation.Status='2') and SR_reservation.RoomNo=SR_room.RoomNo and SR_reservation.ClassID=SR_course.ClassID and SR_reservation.InstructorID=SR_instructor.InstructorID and CONCAT(SR_course.Semester, ' ', SR_course.Year) = '$Semester' order by SR_reservation.InstructorID, Date, StartTime"; // echo $query; $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); $num_rows = mysql_num_rows($result); $i=0; $e=0; if ($num_rows == 0) { print "

No reservations are found for next week.

"; exit(); } else { print "

Total number of reservations for next week: ".$num_rows."

"; $ID = ''; while ($row = mysql_fetch_row($result)){ $Title = $row[0]; $Date = $row[1]; $StartTime = $row[2]; $EndTime = $row[3]; $Room = $row[8]; $Course = $row[7].' '.$row[4].' - '.$row[11].' - From '.$row[12].' to '.$row[13]; $FirstName = $row[5]; $LastName = $row[6]; $Email = $row[9]; list ($Year, $Month, $Day) = split ('-', $Date); $Weekday = date("l", mktime(0, 0, 0, $Month, $Day, $Year)); if ( $ID != $row[14]) { if ( $ID != '') { $TEXT=$TEXT."---------------------------------------------------------------------------------\n\n"; $TEXT=$TEXT."If you have any question, please call our at 909-274-4580, or simply reply to this email. We will get back to you as soon as we can.\n\n"; $TEXT=$TEXT."Thank you, Language Learning Center\n"; $i++; if ($Email0 != '') { SendMail( "langlab@mtsac.edu","Language Learning Center", //sender $Email0, $FirstName0." ".$LastName0, //recipient "", // copy to "Reminder: you have LLC reservations next week ", //subject $TEXT,$HTML,$ATTM); //body and attachment(s) $e++; print "
Email sent to ".$Email0." for ".$FirstName0." ".$LastName0; } else { print "
No email address for ".$FirstName0." ".$LastName0; } } $ID = $row[14]; $TEXT="Dear Prof. $FirstName $LastName\n\n"; $TEXT=$TEXT."This email is to remind you that you have reservations for next week. It is important to cancel if you cannot make it.\n\n"; } $TEXT=$TEXT."---------------------------------------------------------------------------------\n"; $TEXT=$TEXT."On $Month/$Day/$Year $Weekday\n"; $TEXT=$TEXT."$Title - $Room\n"; $TEXT=$TEXT."From $StartTime to $EndTime\n"; $TEXT=$TEXT."For class: $Course\n"; $FirstName0 = $FirstName; $LastName0 = $LastName; $Email0 = $Email; } $TEXT=$TEXT."---------------------------------------------------------------------------------\n\n"; $TEXT=$TEXT."If you have any question, please call us at 909-274-4580, or simply reply to this email. We will get back to you as soon as we can.\n\n"; $TEXT=$TEXT."Thank you, Language Learning Center\n"; $i++; if ($Email0 != '') { SendMail( "langlab@mtsac.edu","Language Learning Center", //sender $Email0, $FirstName0." ".$LastName0, //recipient "", // copy to "Reminder of your next week's Language Learning Center reservations ", //subject $TEXT,$HTML,$ATTM); //body and attachment(s) $e++; print "
Email sent to ".$Email0." for ".$FirstName0." ".$LastName0; } else { print "
No email address for ".$FirstName0." ".$LastName0; } print "

Number of instructors: ".$i."

"; print "

Number of emails sent: ".$e."

"; } $query = "insert into SR_reminder set Date=CURDATE(), Time=CURTIME(), User='$user'"; $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); ?>