function RecursiveCat($pid, $sel) { $db = new myDBC(); static $level = 0; static $strid = ""; static $strname = ""; $sql = $db->runQuery("select * from " . CATEGORY . " where parent_id =" . $pid . " "); while ($row = $db->getQuery($sql)) { $id = $row['page_id']; $level--; $pad = ""; for ($p = 1; $p < $level * -1; $p++) { $pad .= " > "; } $ys = ''; if ($sel == $row['page_id']) { $ys = 'selected'; } $strname .= '<option ' . $ys . ' value="' . $row['page_id'] . '">' . $pad . ucwords($row['page_name']) . '</option>'; $rid = RecursiveCat($id, $sel); $strid[] = $row['page_id']; $level++; } return $strname; }
function RecursiveCat($pid, $sel = '', $sel1) { $db = new myDBC(); if ($sel) { $cnd = "and category_parent!='{$sel}'"; } static $level = 0; static $strid = ""; static $strname = ""; $sql = $db->runQuery("select * from " . CAT . " where category_parent='{$pid}' {$cnd} "); while ($row = $db->getQuery($sql)) { $id = $row['id']; $level--; $pad = ""; for ($p = 1; $p < $level * -1; $p++) { $pad .= " > "; } $ys = ''; if ($sel1 == $row['id']) { $ys = 'selected'; } $strname .= '<option ' . $ys . ' value="' . $row['id'] . '">' . $pad . ucwords(strtolower($row['category_title'])) . '</option>'; $rid = RecursiveCat($id, $sel, $sel1); $strid[] = $row['id']; $level++; } return $strname; }