FAQ Management"); // make the array that has all the faq in a nice structured $res = sql_query("SELECT faq.id, faq.link_id, faq.lang_id, lang_name, faq.question, faq.flag, faq.order FROM faq LEFT JOIN language on faq.lang_id = language.id WHERE type='categ' ORDER BY lang_name, `order` ASC"); while ($arr = mysql_fetch_array($res, MYSQL_BOTH)) { $faq_categ[$arr[lang_id]][$arr[link_id]][title] = $arr[question]; $faq_categ[$arr[lang_id]][$arr[link_id]][flag] = $arr[flag]; $faq_categ[$arr[lang_id]][$arr[link_id]][order] = $arr[order]; $faq_categ[$arr[lang_id]][$arr[link_id]][id] = $arr[id]; $faq_categ[$arr[lang_id]][$arr[link_id]][lang_name] = $arr[lang_name]; } $res = sql_query("SELECT faq.id, faq.question, faq.lang_id, faq.flag, faq.categ, faq.order FROM faq WHERE type='item' ORDER BY `order` ASC"); while ($arr = mysql_fetch_array($res)) { $faq_categ[$arr[lang_id]][$arr[categ]][items][$arr[id]][question] = $arr[question]; $faq_categ[$arr[lang_id]][$arr[categ]][items][$arr[id]][flag] = $arr[flag]; $faq_categ[$arr[lang_id]][$arr[categ]][items][$arr[id]][order] = $arr[order]; } if (isset($faq_categ)) { // gather orphaned items foreach ($faq_categ as $lang => $temp2){ foreach ($temp2 as $id => $temp) { if (!array_key_exists("title", $temp2[$id])) { foreach ($temp2[$id][items] as $id2 => $temp) { $faq_orphaned[$lang][$id2][question] = $temp2[$id][items][$id2][question]; $faq_orphaned[$lang][$id2][flag] = $temp2[$id][items][$id2][flag]; unset($temp2[$id]); } } } } // print the faq table print("
\n"); print("When the position numbers don't reflect the position in the table, it means the order id is bigger than the total number of sections/items and you should check all the order id's in the table and click \"reorder\"
"); echo $pagerbottom; end_main_frame(); stdfoot(); ?>