function fetchKeywords($keySubcat) { $result = sql_query("SELECT * FROM `keywords` " . "WHERE `keySubcat` = '{$keySubcat}' ORDER BY `keyWord`"); $keywords = array(); while ($rowData = mysql_fetch_assoc($result)) { $keyid = $rowData["keyid"]; $rowData["keyWord"] = trim(preg_replace('/^.*\\|/', "", $rowData["keyWord"])); $keywords[$keyid] = $rowData; $subKeywords = fetchKeywords($keyid); if (count($subKeywords)) { $keywords[$keyid]["subcats"] = $subKeywords; } } mysql_free_result($result); return $keywords; }
<?php set_time_limit(1500); include_once INCLUDES . "keywording.php"; $keywords = fetchKeywords(0); // Appearances passed to writeKeywordData(): define("KWD_APP_OPEN", "-2"); // Open content define("KWD_APP_CLOSE", "-1"); // Close content define("KWD_APP_CLEAR", "0"); // Clear content define("KWD_APP_SWITCH", "1"); // Switch from header into container define("KWD_APP_TAB", "2"); // Tab, non-selectable define("KWD_APP_KEYWORD", "3"); // Keyword, selectable define("KWD_APP_KEYWORD_TAB", "4"); // Tab+Keyword, selectable define("KWD_APP_HEADER", "5"); // Group title (large text) define("KWD_APP_HLINE", "6"); // Horizontal line $keywordData = "var KeywordData = new Array("; $keywordDataLast = 0; $keywordCaptions = array(); $keywordCaptionLast = 0; $keywordDesc = array(); // Note: First character of a parameter name must be unique within $params, // i.e. all parameter names must begin with different characters. Currently
<?php include_once INCLUDES . "keywording.php"; $keywords = "('"; $keywords .= implode("', '", array_keys(fetchKeywords("38"))); $keywords .= "')"; $limit = mysql_result(mysql_query("SELECT COUNT(*) FROM `objKeywords` WHERE `objKkeyword` IN " . $keywords), 0); $limit2 = mysql_result(mysql_query("SELECT COUNT(*) FROM `keywords` WHERE `keyid` IN " . $keywords), 0); $query = "DELETE FROM `objKeywords` WHERE `objKkeyword` IN " . $keywords . " LIMIT " . $limit . ";"; $query2 = "DELETE FROM `keywords` WHERE `keyid` IN " . $keywords . " LIMIT " . $limit2 . ";"; print $query . "<br />" . $query2;