function showKeywordList($objid) { $result = sql_query("SELECT `objKkeyword` FROM `objKeywords` " . "WHERE `objKobject` = '" . $objid . "'"); $idList = array(); while ($rowData = mysql_fetch_row($result)) { $idList[] = $rowData[0]; } $stringList = array(); foreach ($idList as $keyid) { $stringList[$keyid] = "• " . traverseKeyword($keyid, true) . "<br />"; } sort($stringList); echo implode("", $stringList); if ($stringList == "") { echo _NONE; } }
function traverseKeyword($keyid) { $result = sql_query("SELECT `keyWord`,`keySubcat` FROM `keywords` " . "WHERE `keyid` = '" . intval($keyid) . "' LIMIT 1"); if (mysql_num_rows($result) == 0) { return "???"; } $kwName = mysql_result($result, 0, 0); $kwSubcat = mysql_result($result, 0, 1); $kwName = trim(preg_replace('/^.*\\|/', "", preg_replace('/\\@$/', "", $kwName))); if ($kwSubcat != 0) { $kwName = traverseKeyword($kwSubcat) . " - " . $kwName; } return $kwName; }