mam taki kod:
<?php public function delCatAndParent() { $db = parent::Connect(); $db->query("set names 'utf8'"); $db->whereAdd("Parent = '$this->_where'"); $db->find(); while($db->fetch()) { $db1 = parent::Connect(); $db1->query("set names 'utf8'"); $db1->whereAdd("Parent = '$db->Id'"); $db1->find(); while($db1->fetch()) { $db2 = parent::Connect(); $db2->query("set names 'utf8'"); $db2->whereAdd("Parent = '$db1->Id'"); $db2->find(); while($db2->fetch()) { $db3 = parent::Connect(); $db3->query("set names 'utf8'"); $db3->whereAdd("Parent = '$db2->Id'"); $db3->find(); while($db3->fetch()) { $db4 = parent::Connect(); $db4->query("set names 'utf8'"); $db4->whereAdd("Parent = '$db3->Id'"); $db4->find(); while($db4->fetch()) { $db5 = parent::Connect(); $db5->query("set names 'utf8'"); $db5->whereAdd("Parent = '$db4->Id'"); $db5->find(); while($db5->fetch()) { $result1[] = $db5->toArray(); } $result1[] = $db4->toArray(); } $result1[] = $db3->toArray(); } $result1[] = $db2->toArray(); } $result1[] = $db1->toArray(); } $result1[] = $db->toArray(); } return $result1; } ?>
jest on ograniczona jak widać do 5 wgłębien w kategorie a ja chce aby nie było ograniczenia czyli listuje kategorie potem dla kazdej pobiera Id i wchodzi do niej i tak az wylistuje wszystko co jest w danej kategori..
np:
test
test 1
test 2
test 3
test 3.1
test 3.2
test 3.2.1
test 3.2.2
i funkcja ma wylistowac wszystko co jest w kategori test.. to wyżej działa ale jak bedzie 10 wgłębien to kapa trzeba to jakoś uproscić.