0) { $get_search = mysql_prep(removecrap($get_search)); $query_where .= " AND a.title LIKE '%$get_search%'"; $page_title = $get_search; } else { $query_where .= " AND a.category_id = '{$get_cid}'"; } // Product Search Query - end $query = " SELECT a.id AS id, a.title AS title, a.content AS content, a.price AS price FROM products AS a WHERE $query_where ORDER BY $sql_order_by "; $result = mysql_query($query); $totality = mysql_num_rows($result); // Total Records $maxperpage = $show; // Set maximum records per page $totalpages = ceil($totality/$maxperpage); // Total Pages $currentpage = intval($_GET["page"]); // Get Current Page if ($currentpage < 0 ) { $currentpage = 0; } else if ($currentpage > $totalpages) { $currentpage = $totalpages - 1; } // Current Page - default is the start or 0, if greater than last page then set to last page $actualpage = $currentpage + 1; // Actual Page is number + 1 $startindex = $currentpage*$maxperpage; // Record to start with if ($actualpage == $totalpages OR $totality == 0) { $showcurrent = $totality; } else {$showcurrent = $actualpage * $show; } // Show current Page $pagerlimit = 20; // Set maximum page links $pagerset = floor(($currentpage + $pagerlimit) / $pagerlimit); $pagerend = $pagerset * $pagerlimit; $pagerstart = ($pagerend - $pagerlimit) + 1; if ($pagerend >= $totalpages) { $pagerend = $totalpages; } // last page if ($totalpages <= 0) { $totalpages = 1; } $page = $currentpage; $item_start_no = ($actualpage * $show) - ($show - 1); // item start number $default_link = WEB."products.php?cid=".$get_cid; $show_link = $default_link."&sort=".$sort; $sort_link = $default_link."&page=".$page."&show=".$show; $paging_link = $default_link."&sort=".$sort."&show=".$show; $filter_link = $default_link."&show=".$show."&page=".$page."&sort=".$sort; // Create array for listing - start if ($totality > 0) { $result = mysql_query("$query LIMIT $startindex, $maxperpage"); $total_current_page = mysql_num_rows($result); // Total Records on current page $item_end_no = $item_start_no + $total_current_page - 1; // item start number while ($row = mysql_fetch_array($result)) { $row_array[] = $row; } mysql_free_result($result); // Release from memory - groups } // Create array for listing - end //********** SQL - end **********// $product_flag = 1; $page_id = 2; $html_page_title = "PC Options -> products -> ".$page_title; $html_page_desc = $page_title; $html_page_keywords = $page_title; $breadcrumb_title = "Products"; $breadcrumb_href = WEB."products.php?cid=".$get_cid; $breadcrumb_2_title = $page_title; $breadcrumb_2_href = WEB."products.php?cid=".$get_cid; ?>