我正在尝试将更改后的数组推入类成员,但是由于某种原因,它只是将第二个元素替换为第一个元素。
class Registration {
var $formID;
var $formKeys;
var $registrations = array();
function __construct($a) {
$this->formID = $a;
global $wpdb;
$keys = $wpdb->get_results('SELECT * FROM wp_nf3_fields WHERE parent_id = '.$a);
$labels = array();
foreach($keys as $key) {
$labels['_field_'.$key->id] = $key->label;
}
$this->formKeys = $labels;
}
function get_registrations() {
global $wpdb;
// Get IDs of fields
$IDs = $wpdb->get_results('SELECT wp_posts.ID FROM wp_posts JOIN wp_postmeta ON wp_postmeta.post_id = wp_posts.ID WHERE wp_posts.post_type = "nf_sub" AND wp_postmeta.meta_key = "_form_id" AND wp_postmeta.meta_value = "'.$this->formID.'"');
foreach ($IDs as $id) {
$id = $id->ID;
$regs = $wpdb->get_results('SELECT * FROM `wp_postmeta` WHERE wp_postmeta.post_id = '.$id);
$events = unserialize($regs[8]->meta_value);
$numberOfEvents = count($events);
$tempEvent = "";
foreach($events as $key => $value) {
array_push($this->registrations, $regs);
$this->registrations[count($this->registrations)-1][8]->meta_value = $events[$key];
}
}
$registrations = $this->clean_up_data($this->registrations);
return $registrations;
}
}
您可以在此URL看到返回的内容。 https://www.ulmaonline.com/tournament/tournament-information/
我知道我必须缺少一些非常简单的东西。但是我似乎找不到。
答案 0 :(得分:0)
我没有找到此错误的答案,但是我确实找到了解决需要完成的工作的方法。如果有人弄清楚了,那就太好了。