Main Content

3

3

2500) AND COMMUNITY_NAME = ‘aqualane shores’ OR COMMUNITY_NAME = ‘audubon’ OR COMMUNITY_NAME = ‘barefoot beach’ OR COMMUNITY_NAME = ‘bonita bay’ OR COMMUNITY_NAME = ‘bonita beach’ OR COMMUNITY_NAME = ‘cape marco’ OR COMMUNITY_NAME = ‘captiva beach’ OR COMMUNITY_NAME = ‘coquina sands’ OR COMMUNITY_NAME = ‘grey oaks’ OR COMMUNITY_NAME = ‘hideaway beach’ OR COMMUNITY_NAME = ‘marco beach’ OR COMMUNITY_NAME = ‘mediterra’ OR COMMUNITY_NAME = ‘olde naples’ OR COMMUNITY_NAME = ‘palmetto point’ OR COMMUNITY_NAME = ‘park shore’ OR COMMUNITY_NAME = ‘pelican bay’ OR COMMUNITY_NAME = ‘pelican isle’ OR COMMUNITY_NAME = ‘pelican marsh’ OR COMMUNITY_NAME = ‘pine ridge’ OR COMMUNITY_NAME = ‘port royal’ OR COMMUNITY_NAME = ‘quail west’ OR COMMUNITY_NAME = ‘royal harbor’ OR COMMUNITY_NAME = ‘seagate’ OR COMMUNITY_NAME = ‘south seas island re’ OR COMMUNITY_NAME = ‘south seas island resort’ OR COMMUNITY_NAME = ‘the quarry’ OR COMMUNITY_NAME = ‘the sanctuary’ OR COMMUNITY_NAME = ‘tiburon’ OR COMMUNITY_NAME = ‘vanderbilt beach’ OR COMMUNITY_NAME = ‘vineyards’ “;

if (defined(‘SITE_CITY’)) {
$query .= “AND CITY = ‘”. SITE_CITY . “‘ “;
}

if (defined(‘SITE_AREA’)) {
$query .= “AND COMMUNITY_NAME = ‘”. SITE_AREA . “‘ “;
}

$query .= ” ORDER BY COMMUNITY_NAME LIMIT 100″;

$result_query = $wpdb->get_results($query);

// print_r($result_query); die;
//foreach ($result_query as $result_row) {
$sizeofResult=sizeof($result_query);
for ($index=intdiv(2*$sizeofResult,3)+1;$index<$sizeofResult;$index++){ $result_set[] = ucwords(strtolower($result_query[$index]->COMMUNITY_NAME));
}
sort($result_set);

echo ‘

    ‘;

    foreach ($result_set as $show) {

    // Determine the highest price
    $new_query = “SELECT SALE_PRICE “.
    “FROM idx_listing_table “.
    “WHERE COMMUNITY_NAME = ‘” . $show . “‘ “;

    if (defined(‘SITE_CITY’)) {
    $new_query .= “AND CITY = ‘”. SITE_CITY . “‘ “;
    }

    if (defined(‘SITE_AREA’)) {
    $new_query .= “AND COMMUNITY_NAME = ‘”. SITE_AREA . “‘ “;
    }

    $new_query .= “ORDER BY SALE_PRICE DESC LIMIT 1”;

    $new_result_query = $wpdb->get_results($new_query);

    foreach($new_result_query as $new_result_row){
    $price_to = $new_result_row->SALE_PRICE;
    }

    $price_range = ‘$’ . number_format($price_to);

    // Count listings
    // $new_query = “SELECT COUNT(*) “.
    $new_query = “SELECT SALE_PRICE “.
    “FROM idx_listing_table “.
    “WHERE (SALE_PRICE > 2500) AND COMMUNITY_NAME = ‘” . $show . “‘ “;

    if (defined(‘SITE_CITY’)) {
    $new_query .= “AND CITY = ‘”. SITE_CITY . “‘ “;
    }

    if (defined(‘SITE_AREA’)) {
    $new_query .= “AND COMMUNITY_NAME = ‘”. SITE_AREA . “‘ “;
    }

    $new_query .= “LIMIT 100”;

    $new_result_query = $wpdb->get_results($new_query);
    $counter = sizeof($new_result_query);

    $url = strtolower(str_replace(‘%20’, ‘-‘, $show));
    $url = strtolower(str_replace(‘ ‘, ‘-‘, $show));

    if($counter > 0) echo ‘

  • ‘.$show.’
    Prices up to ‘.$price_range.’
  • ‘;
    }

    echo ‘

‘;
?>

Send Us A Message

Skip to content