0

我正在使用 WordPress 的 RSVP 插件并对其进行了修改,以便它可以显示哪些客人被邀请参加哪个活动。当他们进入并回复时,它会发送一封电子邮件,目前看起来像这样:

if((get_option(OPTION_NOTIFY_ON_RSVP) == "Y") && (get_option(OPTION_NOTIFY_EMAIL) != "")) {
    $sql = "SELECT firstName, lastName, rsvpStatus FROM ".ATTENDEES_TABLE." WHERE id= ".$attendeeID;
    $attendee = $wpdb->get_results($sql);
    if(count($attendee) > 0) {
        $body = "Hello, \r\n\r\n";

        $body .= stripslashes($attendee[0]->firstName)." ".stripslashes($attendee[0]->lastName).
                         " has submitted their RSVP and has RSVP'd with '".$attendee[0]->rsvpStatus."'.";

        wp_mail(get_option(OPTION_NOTIFY_EMAIL), "New RSVP Submission", $body);
    }
}

在我的数据库中,我有一个名为 rsvpEvent 的字段,我希望它获取数据并显示该人对该事件的回复。我尝试将其添加到其中:

if((get_option(OPTION_NOTIFY_ON_RSVP) == "Y") && (get_option(OPTION_NOTIFY_EMAIL) != "")) {
    $sql = "SELECT firstName, lastName, rsvpStatus FROM ".ATTENDEES_TABLE." WHERE id= ".$attendeeID;
    $attendee = $wpdb->get_results($sql);
    if(count($attendee) > 0) {
        $body = "Hello, \r\n\r\n";

        $body .= stripslashes($attendee[0]->firstName)." ".stripslashes($attendee[0]->lastName).
                          "has been invited to '".$attendee[0]->rsvpEvent."'." "and has submitted their RSVP and has RSVP'd with '".$attendee[0]->rsvpStatus."'.";

        wp_mail(get_option(OPTION_NOTIFY_EMAIL), "New RSVP Submission", $body);
    }
}

但这会使我的整个网站崩溃,谁能给我一些提示或提示我哪里出错了?

4

1 回答 1

0

您没有从数据库中获取rsvpEvent字段。

尝试将其添加到您的 SELECT 查询中,如下所示:

if((get_option(OPTION_NOTIFY_ON_RSVP) == "Y") && (get_option(OPTION_NOTIFY_EMAIL) != "")) {
    $sql = "SELECT firstName, lastName, rsvpStatus, rsvpEvent FROM ".ATTENDEES_TABLE." WHERE id= ".$attendeeID;
    $attendee = $wpdb->get_results($sql);
    if(count($attendee) > 0) {
        $body = "Hello, \r\n\r\n";

        $body .= stripslashes($attendee[0]->firstName)." ".stripslashes($attendee[0]->lastName).
                          "has been invited to '".$attendee[0]->rsvpEvent."'." "and has submitted their RSVP and has RSVP'd with '".$attendee[0]->rsvpStatus."'.";

        wp_mail(get_option(OPTION_NOTIFY_EMAIL), "New RSVP Submission", $body);
    }
}
于 2013-09-24T15:22:14.950 回答