= '$_GET[MinPrice]' "; } if(!empty($_GET[MaxPrice])) { $query[] = "re2_listings.price <= '$_GET[MaxPrice]' "; } if(!empty($_GET[rooms1])) { $query[] = "re2_listings.rooms >= '$_GET[rooms1]' "; } if(!empty($_GET[rooms2])) { $query[] = "re2_listings.rooms <= '$_GET[rooms2]' "; } if(!empty($_GET[bath1])) { $query[] = "re2_listings.bathrooms >= '$_GET[bath1]' "; } if(!empty($_GET[bath2])) { $query[] = "re2_listings.bathrooms <= '$_GET[bath2]' "; } if(!empty($_GET[before])) { $MyDate = strtotime("-$_GET[before]"); $query[] = "re2_listings.DateAdded >= '$MyDate' "; } if(!empty($_GET[school])) { $query[] = "re2_listings.NearSchool = 'y' "; } if(!empty($_GET[transit])) { $query[] = "re2_listings.NearTransit = 'y' "; } if(!empty($_GET[park])) { $query[] = "re2_listings.NearPark = 'y' "; } if(!empty($_GET[ocean_view])) { $query[] = "re2_listings.OceanView = 'y' "; } if(!empty($_GET[lake_view])) { $query[] = "re2_listings.LakeView = 'y' "; } if(!empty($_GET[mountain_view])) { $query[] = "re2_listings.MountainView = 'y' "; } if(!empty($_GET[ocean_waterfront])) { $query[] = "re2_listings.OceanWaterfront = 'y' "; } if(!empty($_GET[lake_waterfront])) { $query[] = "re2_listings.LakeWaterfront = 'y' "; } if(!empty($_GET[river_waterfront])) { $query[] = "re2_listings.RiverWaterfront = 'y' "; } if(!empty($query)) { $MyQuery = implode(" and ", $query); $MyQuery = "and ".$MyQuery; } //////////////////////////////////////////////////////////// ////////// order by $order = array(); if(!empty($_GET[orderby])) { $MyOrder = explode("|", $_GET[orderby]); while(list(,$ov) = each($MyOrder)) { if($ov == "DateAdded") { $order[] = " re2_listings.DateAdded desc "; } if($ov == "Price") { $order[] = " re2_listings.Price asc "; } if($ov == "address") { $order[] = " re2_listings.address asc "; } } } else { if(!empty($_GET[p])) { $order[] = " re2_listings.Price asc "; } if(!empty($_GET[r])) { $order[] = " re2_listings.rooms asc, re2_listings.bathrooms asc, re2_listings.garage asc "; } if(!empty($_GET[city])) { $order[] = " re2_listings.city, re2_listings.address, re2_listings.state "; } } if(count($order) > '0') { $MyOrder = implode(", ", $order); } if(empty($MyOrder)) { $MyOrder = " order by re2_agents.PriorityLevel desc, re2_listings.DateAdded desc"; } else { $MyOrder = " order by re2_agents.PriorityLevel desc, $MyOrder"; } if(!empty($_GET[Start])) { $Start = $_GET[Start]; } else { $Start = '0'; } $ByPage = '20'; $q1 = "select * from re2_listings, re2_agents, re2_priority where re2_listings.AgentID = re2_agents.AgentID and re2_agents.PriorityLevel = re2_priority.PriorityLevel and re2_agents.AccountStatus = 'active' $MyQuery $MyOrder limit $Start, $ByPage "; $qnav = "select * from re2_listings, re2_agents where re2_listings.AgentID = re2_agents.AgentID $MyQuery"; $r1 = mysql_query($q1) or die(mysql_error()); $lrows = mysql_num_rows($r1); if($lrows > '0') { $ListingTable .= "\n"; while($a1 = mysql_fetch_array($r1)) { $ListingTable .= "\n\t"; if($a1[PriorityLevel] > '1') { $sub = "$a1[PriorityName]"; } $ListingTable .= "\n\t\n\t"; $ListingTable .= "\n\t"; $ListingTable .= "\n\t\n"; $ListingTable .= "\n"; } $ListingTable .= "
"; if(!empty($a1[image])) { $ListingTable .= ""; } $ListingTable .= "$a1[city], $a1[state], $a1[address] $submaximaal $a1[rooms] personen"; $MyPrice = number_format($a1[Price], 2, ",", "."); $ListingTable .= "€$MyPrice
"; $rnav = mysql_query($qnav) or die(mysql_error()); $rows = mysql_num_rows($rnav); if($rows > $ByPage) { $ListingTable .= "
"; $ListingTable .= ""; $ListingTable .= "
| "; $pages = ceil($rows/$ByPage); for($i = 0; $i <= ($pages); $i++) { $PageStart = $ByPage*$i; $i2 = $i + 1; if($PageStart == $Start) { $links[] = " $i2\n\t "; } elseif($PageStart < $rows) { $links[] = " $i2\n\t "; } } $links2 = implode(" | ", $links); $ListingTable .= $links2; $ListingTable .= "|

\n"; } } else { $ListingTable = "

Er zijn geen advertenties gevonden die aan de criteria voldoen!
"; } require_once("templates/HeaderTemplate.php"); require_once("templates/SearchTemplate.php"); require_once("templates/FooterTemplate.php"); ?>