0 AND status>10 AND (description LIKE '%$mini_search_string%' OR country LIKE '%$mini_search_string%' OR city LIKE '%$mini_search_string%' OR custom1 LIKE '%$mini_search_string%' OR custom2 LIKE '%$mini_search_string%' OR custom3 LIKE '%$mini_search_string%' OR property_id='$mini_search_string' )"; } else { //if no search has been performed, go back to home page if ($_SESSION['searchsession'] !="set") echo ""; //get variables from session $search_country=$_SESSION['search_country']; $search_city=$_SESSION['search_city']; $search_property=$_SESSION['search_property']; $search_feature=$_SESSION['search_feature']; $search_saletype=$_SESSION['search_saletype']; //Now set up the search text string $searchtext="property_id>0 AND status>10 "; if ($search_country !="" && $search_country!=="-") $searchtext.="AND country='$search_country' "; if ($search_city !="" ) $searchtext.="AND city='$search_city' "; if ($search_property !="") $searchtext.="AND property='$search_property' "; if ($search_feature !="") $searchtext.="AND feature='$search_feature' "; if ($search_saletype !="") $searchtext.="AND saletype='$search_saletype' "; //Remove the last comma if there is one $len=strlen($searchtext)-1; $lastchar=$searchtext{$len}; if ($lastchar==",") $searchtext=substr($searchtext,0,$len); } if (strlen($searchtext)>1) $result=mysql_query(" SELECT * FROM properties WHERE $searchtext ORDER BY property_id DESC"); else $result=mysql_query(" SELECT * FROM properties LIMIT 201"); $num=mysql_numrows($result); if ($num>199) { $num=200; $over="over"; } //work out results per page to get start and end rows $perpage=10; $page=$_REQUEST['page']; $last=ceil($num/$perpage); if (!isset($page)) { $page=1; $start=0; $end=$perpage; } else { $end=$perpage*$page; $start=$end-$perpage; } $startshow=$start+1; if ($end>$num) $endshow=$num; else $endshow=$end; //Debug Only //echo "perpage=$perpage, page=$page, start=$start, end=$end last=$last
"; if ($num==0 ) { echo "No listings found matching those search criteria

Try searching again "; } else { echo "
"; $i=$start; while ($i<$end && $i<$num) { $property_id=mysql_result($result,$i,"property_id"); $country=mysql_result($result,$i,"country"); $city=mysql_result($result,$i,"city"); $description=mysql_result($result,$i,"description"); $pic=mysql_result($result,$i,"pic"); $description=substr($description,0,185); if (!file_exists("images/properties/$property_id/$pic")) { $pic="art/1.jpg"; $thumb="art/1_thumb.jpg"; } else $thumb="images/properties/$property_id/thumbs/$pic"; echo " "; if ($i==$start+4) echo "
$city, $country - Property #$property_id
$description
...click for more
"; $i++; } echo "
"; //Now do navigation links $next=$page+1; $prev=$page-1; $viewpages=11; $displaylast=$page+$viewpages; $displayfirst=$page-$viewpages; if($displaylast>$last) $displaylast=$last; if($displayfirst<2) $displayfirst=1; if ($next>$last) $next=$last; if ($prev<2) $prev=1; echo "
\"\"
"; } ?>