= '$today' and start_date < '$end_date') " . "or (end_date >= '$today' and end_date < '$end_date')) " . "order by start_date,end_date"; $events = db_query($query); $num_events = db_num_rows($events); if ($num_events == 0) continue; // // Process the events // $message = "
\n" . " \n" . " \n" . " \n" . " \n"; $count = 0; while ($event = db_fetch_array($events)) { extract($event); $class = 'data-even'; if ($count %2 ) $class = 'data-odd'; $count++; if (strlen($location) > 0) $location = " -- @ $location"; $message .= " \n" . " \n" . " \n" . " \n" . " \n" . " \n"; } $message .= "
Upcoming Events from $pac_name Event Calendar
$title
$date_and_time $location

\n" . "
\n"; // // Determine how many matching records there are // $where_clause = "where email is not null and email != '' and school_num = $base_school_num and receive_emails = 'Y' "; // $where_clause .= "and userid = 'mfester' "; $query = "select count(*) from users " . $where_clause; $matching_records = db_getVal($query); // // Create email header // $category = "Parent Events Broadcast"; $description = "Broadcast to Parents"; $reply_address = $school['reply_email']; $reply_description = $school['reply_description'] . " Events"; $email_message_id = 0; $subject = "$pac_name Event Calendar"; $message_text = db_getVal("select content from formatted_content where school_num = $school_num and content_type = 'Events'"); $message_text .= $message; $email_template = "EmailTemplate.html"; $posted = date("Y-m-d H:i:s",time()); $send_after = date("Y-m-d H:i:s",time()); $status = "open"; $user_num = 0; $processed_records = 0; $sent_successfully = 0; $skipped = 0; $errors = 0; $email_field_name = "email"; $primary_table = "users"; $query = "select * from users " . $where_clause . "order by email,record_num"; // Create and insert the header record $insert = $email_header->BuildInsert(); db_query($insert); } ?>