Town: ' . $town . '

'); if ($townname == "All Towns") { $towns_sql = ""; // our database only has monadnock towns, so we can omit the check for town break; } else { if ($towns_sql == "") { $towns_sql .= "(city = '$townname'" ; } else { $towns_sql .= " OR city = '$townname'"; } } } if ($towns_sql != "") { $towns_sql = " AND " . $towns_sql. ") "; // close parentheses } $propertytype_sql = ""; foreach ($propertytypes as $propertytype) { $propertytype_name = mysql_real_escape_string($propertytype); //echo ('

Property Type: ' . $propertytype . '

'); if ($propertytype_sql == "") { $propertytype_sql .= "(ptype = '$propertytype_name'" ; } else { $propertytype_sql .= " OR ptype = '$propertytype_name'"; } } if ($propertytype_sql != "") { $propertytype_sql = " AND " . $propertytype_sql. ") "; // close parentheses } $condition = "price >= $minprice AND price <= $maxprice"; $condition .= " AND bed >= $minbeds AND bath >= $minbaths"; //print ('

DEBUG3 condition = ' .$condition . '

'); if ($minacres != '' && is_numeric($minacres)) { //print ('

DEBUG minacres = ' .$minacres . '

'); $condition .= " AND acres >= $minacres"; //print ('

DEBUG condition = ' .$condition . '

'); } //print ('

DEBUG4 condition = ' .$condition . '

'); if ($minsqft != '' && is_numeric($minsqft)) { //print ('

DEBUG minsqft = ' .$minsqft . '

'); $condition .= " AND sqft >= $minsqft"; //print ('

DEBUG condition = ' .$condition . '

'); } if (isset($_GET['Waterfront'])) { $condition .= " AND water_front != ''"; } if (isset($_GET['NewOnMarket'])) { $condition .= " AND listing_date >= '$lastweek'"; } $condition .= " " . $towns_sql . " " . $propertytype_sql; $condition .= " AND listing_status = 'Active'"; //print ('

DEBUG towns_sql = ' .$towns_sql . '

'); //print ('

DEBUG propertytype_sql = ' .$propertytype_sql . '

'); //print ('

DEBUG condition = ' .$condition . '

'); //print_r($_GET); //exit(); } ?> Despres and Associates

Advanced MLS Property Search
Monadnock Region of NH