我的人际关系表如下:
`relationships` (`relationship_id`, `relationship_individual`, `parent_id`, `partner_id`) VALUES
(28, 160, 161, NULL),
(29, 161, 163, 162),
(30, 162, NULL, 161),
(31, 163, NULL, 164),
(32, 164, NULL, 163),
(34, 166, NULL, 165),
(36, 165, NULL, 166);
我想只展示一次合作伙伴。我想这样做:
foreach($tree as $child) {
foreach($tree as $c) {
if($child['relationship_individual'] != $c['relationship_individual'] && $child['partner_id'] == $c['relationship_individual']){
unset($tree[$child['partner_id']]);
}
}
}
print_r($tree);
但它不起作用,没有任何反应。我该怎么办?