query_vars['q']) ? $wp_query->query_vars['q'] : null; // $year_range = isset($wp_query->query_vars['year']) ? $wp_query->query_vars['year'] : null; $q = isset($_REQUEST['q']) ? $_REQUEST['q'] : NULL; $years = isset($wp_query->query_vars['years']) ? $wp_query->query_vars['years'] : '0-3000'; $page = isset($wp_query->query_vars['page']) ? $wp_query->query_vars['page'] : 1; // print_r($wp_query->query_vars); // print var_dump($q); // print var_dump($year); // if results get the results page content if( isset($q) ) { $post = get_page_by_path( $wp_query->query['pagename'] . '/results'); // get the year $year_range = !empty($years) ? explode('-',$years) : array(0,3000); // get the total amount of entries $count_results = $wpdb->query( "SELECT id FROM entries"); $total_records = $wpdb->num_rows; // get the total amount of entries matching the query if( empty($q) && empty($year_range) ) { // could do something here... } elseif( !empty($q) && !empty($year_range) ) $count_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM entries WHERE FName like %s AND Year >= %d AND Year <= %d", "%{$q}%", $year_range[0], $year_range[1])); elseif( empty($q) && !empty($year_range) ) $count_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM entries WHERE Year >= %d AND Year <= %d", $year_range[0], $year_range[1])); elseif( !empty($q) && empty($year_range) ) $count_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM entries WHERE FName like %s", "%{$q}%")); $match_count = $wpdb->num_rows; // pagination stuff $max_pages = 15; $results_per_page = 10; $page_no = $page; $page_no = $page_no > 0 && $page_no != '' ? $page : 1; $page_start = ($page_no - 1) * $results_per_page; $pages_total = ceil($match_count / $results_per_page); $pages_prev = $page_no >= floor($max_pages/2) ? floor($max_pages/2) : $page_no - 1; $pages_next = $max_pages - $pages_prev - 1; // check if in last few pages if($pages_next+$page_no >= $pages_total) { $pages_next = $pages_total-$page_no; $pages_prev = $max_pages - $pages_next - 1; } // Catch for max pages if($page_no > $pages_total && $pages_total >= 1) return; // need to handle this a bit better... $path = "?q={$q}&years={$years}"; $limit_pages = ($max_pages >= $pages_total); // get the final result set $query = $wpdb->prepare("SELECT * FROM entries WHERE FName like %s AND Year >= %d AND Year <= %d ORDER BY id ASC LIMIT %d,%d", "%{$q}%", $year_range[0], $year_range[1],$page_start,$results_per_page); $results = $wpdb->get_results($query); // print $query; $resultMeta = [ 'q' => $q, 'match_count' => $match_count, 'total_records' => $total_records, 'date' => date('G:i:s \o\n Y-m-d') ]; } ?>

Please enter a surname followed by first name(s) to search the Bolton Street Memorial Park Burial Database. Please note that part of a name can be entered if you are unsure of the correct spelling of a name. For example a search for "wake" will find both Wakefield and Wakeford.

Name:
Date Range:

For further information or alterations to the burial list please contact the Friends of Bolton Street Memorial Park, through Contact Us.