- 1
- 2
$order_by="`name` ASC";
echo mysql_result(mysql_query("SELECT CONCAT('<ul><li>',GROUP_CONCAT(CONCAT('<a href=',`parents`.`id`,'>',`parents`.`name`,'</a>', IFNULL(`children`.`a`,'')) ORDER BY $order_by SEPARATOR '</li><li>'),'</li><ul>') FROM (SELECT `id`,`name` FROM `cats` WHERE `parent_id`=0) parents LEFT JOIN (SELECT `id`, CONCAT('<ul><li>',GROUP_CONCAT(CONCAT('<a href=',`id`,'>',`name`,'</a>') ORDER BY $order_by SEPARATOR '</li><li>'),'</li></ul>') a, `parent_id` FROM cats GROUP BY `parent_id` HAVING `parent_id`<>0) children ON `parents`.`id`=`children`.`parent_id` ;",$cn),0);
istem 22.03.2011 23:22 # +2
bugmenot 23.03.2011 00:08 # +4
Lure Of Chaos 23.03.2011 13:40 # 0