\n";
$order_by = [
'0' => ' DESC',
'1' => ' ASC',
];
$sortby = !empty(Search_Engine::get_param('order')) ? " ORDER BY faq_id".$order_by[Search_Engine::get_param('order')] : '';
switch (Search_Engine::get_param('fields')) {
case 2:
Search_Engine::search_column('faq_question', 'faqs');
Search_Engine::search_column('faq_answer', 'faqs');
Search_Engine::search_column('faq_name', 'faqs');
break;
case 1:
Search_Engine::search_column('faq_answer', 'faqs');
break;
default:
Search_Engine::search_column('faq_question', 'faqs');
}
$result = '';
if (!empty(Search_Engine::get_param('search_param'))) {
$query = "SELECT faq_question, faq_answer, faq_cat_id
FROM ".DB_FAQS."
".(multilang_table("FQ") ? "WHERE ".in_group('faq_language', LANGUAGE)." AND " : "WHERE ").Search_Engine::search_conditions('faqs').$sortby;
$result = dbquery($query, Search_Engine::get_param('search_param'));
$rows = dbrows($result);
} else {
$rows = 0;
}
if ($rows != 0) {
$item_count = "".$rows." ".($rows == 1 ? $locale['fq401'] : $locale['fq402'])." ".$locale['522']."
\n";
$search_result = '';
while ($data = dbarray($result)) {
$text_all = $data['faq_answer'];
$text_all = Search_Engine::search_striphtmlbbcodes($text_all);
$text_frag = Search_Engine::search_textfrag($text_all);
$subj_c = Search_Engine::search_stringscount($data['faq_question']);
$text_c = Search_Engine::search_stringscount($data['faq_answer']);
$context = "