"; global $table_prefix; $category_order = (get_option('mbp_apl_category_order') == '')?'ASC':get_option('mbp_apl_category_order'); $category_orderby = (get_option('mbp_apl_category_orderby') == 'ID')?'a.term_id' : 'a.name'; $post_order = (get_option('mbp_apl_post_order') == 'Random')?"rand()" : "post_date " . get_option('mbp_apl_post_order'); $post_limit = (get_option('mbp_apl_post_limit') == '')?5:get_option('mbp_apl_post_limit'); $categories = get_option('mbp_apl_categories'); $show_comment = get_option('mbp_apl_show_comment'); //getting total categories if ($categories != '') { $query_total_cat = "SELECT a.name as category_name, b.term_id FROM ". $table_prefix ."terms a INNER JOIN ". $table_prefix ."term_taxonomy b ON(a.term_id=b.term_id) WHERE b.taxonomy='category' AND b.count > 0 AND b.term_id IN(". $categories . ")"; } else { $query_total_cat = "SELECT a.name as category_name, b.term_id FROM ". $table_prefix ."terms a INNER JOIN ". $table_prefix ."term_taxonomy b ON(a.term_id=b.term_id) WHERE b.taxonomy='category' AND b.count > 0 "; } $sql_total_cat = mysql_query($query_total_cat); $no_total_cat = mysql_num_rows($sql_total_cat); $start = $_GET['start']; if ($start == $no_total_cat - 1) { $next = 0; } else { $next = $start + 1; } if ($start == 0) { $prev = $no_total_cat - 1; } else { $prev = $start - 1; } if ($categories != '') { $query = "SELECT a.name as category_name, b.term_id FROM ". $table_prefix ."terms a INNER JOIN ". $table_prefix ."term_taxonomy b ON(a.term_id=b.term_id) WHERE b.taxonomy='category' AND b.count > 0 AND b.term_id IN(". $categories . ")" . " ORDER BY ". $category_orderby . " " . $category_order . " LIMIT " . $start . ",1"; } else { $query = "SELECT a.name as category_name, b.term_id FROM ". $table_prefix ."terms a INNER JOIN ". $table_prefix ."term_taxonomy b ON(a.term_id=b.term_id) WHERE b.taxonomy='category' AND b.count > 0 ORDER BY ". $category_orderby . " " . $category_order . " LIMIT " . $start . ",1"; } $sql = mysql_query($query); $rs = mysql_fetch_array($sql); if (mysql_num_rows($sql) > 0) { ?>
Previous Category Next Category