diff --git a/include/class.faq.php b/include/class.faq.php
index 61901f3e973a5b718faa44c57a2df76613a89341..995604b91e04a738fb71839fe0a9049addb52cc3 100644
--- a/include/class.faq.php
+++ b/include/class.faq.php
@@ -89,9 +89,9 @@ class FAQ {
      
         if (!isset($this->topics)) {
             $this->topics = array();
-            $sql='SELECT t.topic_id, t.topic  FROM '.TOPIC_TABLE.' t '
-                .' INNER JOIN '.FAQ_TOPIC_TABLE.' ft USING(topic_id) '
-                .' WHERE ft.faq_id='.db_input($this->id)
+            $sql='SELECT t.topic_id, CONCAT_WS(" / ", pt.topic, t.topic) as name  FROM '.TOPIC_TABLE.' t '
+                .' INNER JOIN '.FAQ_TOPIC_TABLE.' ft ON(ft.topic_id=t.topic_id AND ft.faq_id='.db_input($this->id).') '
+                .' LEFT JOIN '.TOPIC_TABLE.' pt ON(pt.topic_id=t.topic_pid) '
                 .' ORDER BY t.topic';
             if (($res=db_query($sql)) && db_num_rows($res)) {
                 while(list($id,$name) = db_fetch_row($res))
diff --git a/include/class.topic.php b/include/class.topic.php
index ee579e45b2d74e292ff9fd118a5547e32aa2b553..1b235e13f637d84d833dbfb3a359481e464f596a 100644
--- a/include/class.topic.php
+++ b/include/class.topic.php
@@ -144,8 +144,7 @@ class Topic {
     function getHelpTopics($publicOnly=false) {
 
         $topics=array();
-        $sql='SELECT ht.topic_id'
-            .', IF(ht2.topic_pid IS NULL, ht.topic, CONCAT_WS(" / ", ht2.topic, ht.topic)) as name '
+        $sql='SELECT ht.topic_id, CONCAT_WS(" / ", ht2.topic, ht.topic) as name '
             .' FROM '.TOPIC_TABLE. ' ht '
             .' LEFT JOIN '.TOPIC_TABLE.' ht2 ON(ht2.topic_id=ht.topic_pid) '
             .' WHERE ht.isactive=1';
diff --git a/include/client/knowledgebase.inc.php b/include/client/knowledgebase.inc.php
index 2e22b417a373290b934acba8514f4e7042c952f8..2c34a9d82027044d1b824fc68a9e4f690e0a544f 100644
--- a/include/client/knowledgebase.inc.php
+++ b/include/client/knowledgebase.inc.php
@@ -33,19 +33,20 @@ if(!defined('OSTCLIENTINC')) die('Access Denied');
         <select name="topicId" id="topic-id">
             <option value="">&mdash; All Help Topics &mdash;</option>
             <?php
-            $sql='SELECT ht.topic_id, ht.topic, count(faq.topic_id) as faqs '
+            $sql='SELECT ht.topic_id, CONCAT_WS(" / ", pht.topic, ht.topic) as helptopic, count(faq.topic_id) as faqs '
                 .' FROM '.TOPIC_TABLE.' ht '
-                .' LEFT JOIN '.FAQ_TOPIC_TABLE.' faq USING(topic_id) '
+                .' LEFT JOIN '.TOPIC_TABLE.' pht ON (pht.topic_id=ht.topic_pid) '
+                .' LEFT JOIN '.FAQ_TOPIC_TABLE.' faq ON(faq.topic_id=ht.topic_id) '
                 .' WHERE ht.ispublic=1 '
                 .' GROUP BY ht.topic_id '
                 .' HAVING faqs>0 '
-                .' ORDER BY ht.topic DESC ';
+                .' ORDER BY helptopic ';
             if(($res=db_query($sql)) && db_num_rows($res)) {
                 while($row=db_fetch_array($res))
                     echo sprintf('<option value="%d" %s>%s (%d)</option>',
                             $row['topic_id'],
                             ($_REQUEST['topicId'] && $row['topic_id']==$_REQUEST['topicId']?'selected="selected"':''),
-                            $row['topic'], $row['faqs']);
+                            $row['helptopic'], $row['faqs']);
             }
             ?>
         </select>
@@ -57,13 +58,22 @@ if(!defined('OSTCLIENTINC')) die('Access Denied');
 if($_REQUEST['q'] || $_REQUEST['cid'] || $_REQUEST['topicId']) { //Search.
     $sql='SELECT faq.faq_id, question '
         .' FROM '.FAQ_TABLE.' faq '
-        .' LEFT JOIN '.FAQ_CATEGORY_TABLE.' cat USING(category_id) '
+        .' LEFT JOIN '.FAQ_CATEGORY_TABLE.' cat ON(cat.category_id=faq.category_id) '
+        .' LEFT JOIN '.FAQ_TOPIC_TABLE.' ft ON(ft.faq_id=faq.faq_id) '
         .' WHERE faq.ispublished=1 AND cat.ispublic=1';
+    
     if($_REQUEST['cid'])
         $sql.=' AND faq.category_id='.db_input($_REQUEST['cid']);
+    
+    if($_REQUEST['topicId'])
+        $sql.=' AND ft.topic_id='.db_input($_REQUEST['topicId']);
 
-    if($_REQUEST['q'])
-        $sql.=" AND question LIKE ('%".db_input($_REQUEST['q'],false)."%') OR answer LIKE ('%".db_input($_REQUEST['q'],false)."%') OR keywords LIKE ('%".db_input($_REQUEST['q'],false)."%')";
+
+    if($_REQUEST['q']) {
+        $sql.=" AND question LIKE ('%".db_input($_REQUEST['q'],false)."%') 
+                 OR answer LIKE ('%".db_input($_REQUEST['q'],false)."%') 
+                 OR keywords LIKE ('%".db_input($_REQUEST['q'],false)."%')";
+    }
 
     $sql.=' GROUP BY faq.faq_id';
     echo "<div><strong>Search Results</strong></div><div class='clear'></div>";
diff --git a/include/staff/faq-categories.inc.php b/include/staff/faq-categories.inc.php
index 11512a03f4a9e2022cbcd314bfe79365056a310c..8422d1a437e8a6e0193fbaf1d5dd0ae0f1baa80d 100644
--- a/include/staff/faq-categories.inc.php
+++ b/include/staff/faq-categories.inc.php
@@ -32,18 +32,19 @@ if(!defined('OSTSTAFFINC') || !$thisstaff) die('Access Denied');
         <select name="topicId" style="width:350px;" id="topic-id">
             <option value="">&mdash; All Help Topics &mdash;</option>
             <?php
-            $sql='SELECT ht.topic_id, ht.topic, count(faq.topic_id) as faqs '
+            $sql='SELECT ht.topic_id, CONCAT_WS(" / ", pht.topic, ht.topic) as helptopic, count(faq.topic_id) as faqs '
                 .' FROM '.TOPIC_TABLE.' ht '
-                .' LEFT JOIN '.FAQ_TOPIC_TABLE.' faq USING(topic_id) '
+                .' LEFT JOIN '.TOPIC_TABLE.' pht ON (pht.topic_id=ht.topic_pid) '
+                .' LEFT JOIN '.FAQ_TOPIC_TABLE.' faq ON(faq.topic_id=ht.topic_id) '
                 .' GROUP BY ht.topic_id '
                 .' HAVING faqs>0 '
-                .' ORDER BY ht.topic DESC ';
+                .' ORDER BY helptopic';
             if(($res=db_query($sql)) && db_num_rows($res)) {
                 while($row=db_fetch_array($res))
                     echo sprintf('<option value="%d" %s>%s (%d)</option>',
                             $row['topic_id'],
-                            ($_REQUEST['topicId'] && $row['topic_id']==$_REQUEST['cid']?'selected="selected"':''),
-                            $row['topic'], $row['faqs']);
+                            ($_REQUEST['topicId'] && $row['topic_id']==$_REQUEST['topicId']?'selected="selected"':''),
+                            $row['helptopic'], $row['faqs']);
             }
             ?>
         </select>
@@ -53,17 +54,26 @@ if(!defined('OSTSTAFFINC') || !$thisstaff) die('Access Denied');
 <div>
 <?php
 if($_REQUEST['q'] || $_REQUEST['cid'] || $_REQUEST['topicId']) { //Search.
-    $sql='SELECT faq.faq_id, question, ispublished, count(attach.file_id) as attachments '
+    $sql='SELECT faq.faq_id, question, ispublished, count(attach.file_id) as attachments, count(ft.topic_id) as topics '
         .' FROM '.FAQ_TABLE.' faq '
+        .' LEFT JOIN '.FAQ_TOPIC_TABLE.' ft ON(ft.faq_id=faq.faq_id) '
         .' LEFT JOIN '.FAQ_ATTACHMENT_TABLE.' attach ON(attach.faq_id=faq.faq_id) '
         .' WHERE 1 ';
+
     if($_REQUEST['cid'])
         $sql.=' AND faq.category_id='.db_input($_REQUEST['cid']);
 
-    if($_REQUEST['q'])
-        $sql.=" AND question LIKE ('%".db_input($_REQUEST['q'],false)."%') OR answer LIKE ('%".db_input($_REQUEST['q'],false)."%') OR keywords LIKE ('%".db_input($_REQUEST['q'],false)."%')";
+    if($_REQUEST['topicId'])
+        $sql.=' AND ft.topic_id='.db_input($_REQUEST['topicId']);
+
+    if($_REQUEST['q']) {
+        $sql.=" AND question LIKE ('%".db_input($_REQUEST['q'],false)."%') 
+                 OR answer LIKE ('%".db_input($_REQUEST['q'],false)."%') 
+                 OR keywords LIKE ('%".db_input($_REQUEST['q'],false)."%') ";
+    }
 
     $sql.=' GROUP BY faq.faq_id';
+
     echo "<div><strong>Search Results</strong></div><div class='clear'></div>";
     if(($res=db_query($sql)) && db_num_rows($res)) {
         echo '<div id="faq">
diff --git a/include/staff/faq.inc.php b/include/staff/faq.inc.php
index fb87156b97d5f33254efcce57b24b7cfef638c7d..99f4017616245395d905514d3ed2e56b59e6d7a3 100644
--- a/include/staff/faq.inc.php
+++ b/include/staff/faq.inc.php
@@ -109,7 +109,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
             </td>
         </tr>
         <?php
-        $sql='SELECT topic_id, topic FROM '.TOPIC_TABLE;
+        $sql='SELECT ht.topic_id, CONCAT_WS(" / ", pht.topic, ht.topic) as name '
+            .' FROM '.TOPIC_TABLE.' ht '
+            .' LEFT JOIN '.TOPIC_TABLE.' pht ON(pht.topic_id=ht.topic_pid) ';
         if(($res=db_query($sql)) && db_num_rows($res)) { ?>
         <tr>
             <th colspan="2">