function removeEmails($num, $emails_count) { global $application; $tables = $this->getTables(); $table = 'newsletter_temp'; $query = new DB_Delete($table); $query->WhereValue($tables[$table]['columns']['recipient_num'], DB_EQ, $num); $query->DeleteOrder($tables[$table]['columns']['recipient_id'], 'ASC'); $query->DeleteLimit($emails_count); $application->db->PrepareSQL($query); $application->db->DB_Exec(); }