add_error("No country has been supplied"); elseif(!eregi("^[0-9]*$", $county_id)) $page->add_error("No country has been supplied"); else{ $result = q(sprintf("SELECT c.county, a.area_id, a.area, country.country, country.id AS country_id FROM location_county c INNER JOIN location_country country ON country.id = c.country_id LEFT JOIN location_country_areas a ON a.area_id = c.area_id WHERE c.id = %u", intval($county_id)), SITE_DB); $row = mysql_fetch_assoc($result); if(is_array($row)){ $page->set_load_ajax(true); $county = $row['county']; $country_id = $row['country_id']; $country = $row['country']; $area = $row['area']; $area_id = $row['area_id']; //Set meta data $page->set_page_title("Businesses for sale in ".$county); $page->set_page_description("All businesses for sale in " . $county . " including all of " . $county . "'s towns"); $page->add_page_keywords ( $county ); //check for any ordering $sort_order = isset($_POST['sort_by']) ? $_POST['sort_by'] : 1; $sort_direction = isset($_POST['sort_direction']) ? $_POST['sort_direction'] : 1; //check for any filterting $extra_where = ""; if(isset($_POST['go_filter_search'])){ $category = $_POST['search_sector']; $sub_category = isset($_POST['sub_sector']) ? $_POST['sub_sector'] : null; if(!empty($category)) $extra_where = " AND a.category_id = ".intval($category); if(!empty($sub_category)) $extra_where .= " AND a.sub_category_id = ".intval($sub_category); } switch($sort_order){ case 1: //last update $order_by = "a.lastupdate"; break; case 2: //asking price $order_by = "a.asking_price"; break; case 3: //asking price $order_by = "a.turnover"; break; case 4: //asking price $order_by = "a.profit"; break; } $direction = $sort_direction == 1 ? "DESC" : "ASC"; $order_by .= ' ' . $direction; $temp = q(sprintf("SELECT COUNT(1) AS cnt FROM advert_table a WHERE ( a.status = '1' OR a.status = '8' ) AND a.county_id = %u ".$extra_where, intval($county_id)), SITE_DB); $results = mysql_result($temp, 0, 'cnt'); if($results == 0){ $num_pages = 0; $page->set_block_bots(true); } else{ $num_pages = ceil($results / $num_per_page); $start = ($n * $num_per_page) - $num_per_page; $end = $results < $num_per_page ? $results : $num_per_page; $limit = $start. ', ' . $end; $advert_result = q(sprintf("SELECT a.advert_id, a.type, a.title, a.description, a.asking_price, a.profit, a.profit_loss, a.turnover, a.country_id, a.area_id, a.county_id, a.town_id, t.town, opr.profit_text FROM advert_table a LEFT JOIN option_profit_range opr ON opr.profit_id = a.profit_range_id LEFT JOIN location_town t ON t.id = a.town_id WHERE ( a.status = '1' OR a.status = '8' ) AND a.county_id = %u ".$extra_where." ORDER BY " . $order_by . " LIMIT ".$limit, intval($county_id)), SITE_DB); } } else $page->add_error("This category does not exist"); } $page->include_header_file(); ?>

businesses for sale

Businesses for sale -> ',$country,' -> '; if(!empty($area)) echo '',$area,' -> '; echo $county; ?>

We currently have businesses for sale in .

0", intval($county_id)), SITE_DB); $charcount = 0; if(mysql_numrows($result) > 0){ echo 'Browse towns in ',$county,'
'; while($row = mysql_fetch_assoc($result)){ $town_id = $row['id']; $town = $row['town']; $charcount += strlen($town) + 2; if($charcount > 70){ echo "
"; $charcount = 0; } echo '',$town,'  '; } echo '

'; } ?>
Filter category:
'; } ?>


Sort results by:
  


If you want more search options please visit the business for sale search

There are currently no adverts in this section

'; else{ if($num_pages > 1){ echo '
'; echo 'Viewing page ',$n,' of ',$num_pages,'  '; if( $n == 2 ) echo 'Prevous page | '; elseif($n > 1) echo 'Prevous page | '; else echo 'Previous page | '; if($n < $num_pages) echo 'Next page'; else echo 'Next page'; echo '

'; } while($row = mysql_fetch_assoc($advert_result)){ $advert_id = $row['advert_id']; $type = $row['type']; $title = $row['title']; $description = $row['description']; $asking_price = number_format($row['asking_price']); $turnover = number_format($row['turnover']); $town_id = $row['town_id']; $town = $row['town']; $profit_loss_string = $row['profit_loss'] == "1" ? "profit" : "loss"; if ( !empty ( $row['profit_text'] ) ) $profit_string = $row['profit_text']; else $profit_string = "" . number_format ( $row['profit'] ); if( $type == 2 ) { $price_type = "Investment Req"; } else { $price_type = "Asking price"; } $location_string = ""; if(!empty($town)) $location_string = ''.$town.''; $words = explode(" ", $description); //get the 2nd 30 words to make it different from category pages if(count($words) > 90) $description = substr(implode(" ", array_slice($words, 30, 30)), 0, -1); else $description = substr(implode(" ", $words), 0, -1); echo '
'; echo ''; echo ''; echo '

',$title,'

'; if( !empty( $location_string ) ) echo '
',$location_string,'

'; echo '

',$description,'

'; echo '
view full advert

'; echo '
'; } } ?> include_footer_file(); ?>