function get_prereq_items($prereq_id) { global $wpdb; $prereq_items_table_name = get_prereq_items_table_name(); $items = $wpdb->get_results("SELECT item_id FROM " . $prereq_items_table_name . " WHERE prereq_id = " . $prereq_id); return $items; }
function build_prereq_item_sql() { $table_name = get_prereq_items_table_name(); $sql = 'CREATE TABLE `' . $table_name . '` ( `prereq_id` int(10) NOT NULL, `item_id` int(10) NOT NULL, PRIMARY KEY (prereq_id, item_id), FOREIGN KEY (prereq_id) REFERENCES ' . get_prereq_table_name() . '(id) ON DELETE CASCADE, FOREIGN KEY (item_id) REFERENCES ' . get_items_table_name() . '(id) ON DELETE CASCADE )ENGINE=MyISAM DEFAULT CHARSET=latin1;'; return $sql; }