我正在使用WordPress的RSVP插件并对其进行了修改,以便显示哪些访客被邀请参加哪个活动。当他们进入并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的字段,我希望它获取数据并显示该人对该事件的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 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);
}
}
但它崩溃了我的整个网站,任何人都可以给我一些提示或提示我错了吗?
答案 0 :(得分: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);
}
}