Advertisement
Advertisement
| 05.03.2008 at 11:41PM PDT, ID: 23374611 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: |
function searchListings($pageNo,$listAmount,$keyword,$queryType)
{
if($queryType == "adv")//do an 'advanced' search
{
$limit = $listAmount;
if(!isset($_GET['page']))
{
$page = 1;
}else
{
$page = $_GET['page'];
}
$offset = ($page -1) * $limit;
$advSql = "";
//////////////////build query//////////////////////////
if($_POST['priceLow'] > 0)
{
$advSql .= " and ( ListingsMain.listingPrice >= '".$_POST['priceLow']."' )";
}
if($_POST['priceHigh'] > 0)
{
$advSql .= " and ( ListingsMain.listingPrice BETWEEN '".$_POST['priceLow']."' AND '".$_POST['priceHigh']."' ) ";
}
if($_POST['bedroomsHigh'] > 0)
{
$advSql .= " and ( bedrooms BETWEEN '".$_POST['bedrooms']."' AND '".$_POST['bedroomsHigh']."' )";
}elseif($_POST['bedrooms'] > 0)
{
$advSql .= " and ( bedrooms >= '".$_POST['bedrooms']."' )";
}
if($_POST['bathsHigh'] > 0)
{
$advSql .= " and ( totalBaths BETWEEN '".$_POST['baths']."' AND '".$_POST['bathsHigh']."' )";
}elseif($_POST['baths'] > 0)
{
$advSql .= " and ( totalBaths >= '".$_POST['baths']."' )";
}
if(!empty($_POST['city']))
{
$advSql .= " and ( listingCity LIKE '".$_POST['city']."' )";
}
if(!empty($_POST['propertyType']))
{
$advSql .= " and ( listingType LIKE '".$_POST['propertyType']."' )";
}
if(!empty($_POST['categoryCode']))
{
$advSql .= " and ( listingCategory LIKE '".$_POST['categoryCode']."' )";
}
$query = "SELECT ListingsMain.*,ListingDimData.ID,ListingDimData.bedrooms FROM ListingsMain LEFT JOIN ListingDimData ON ListingsMain.ID=ListingDimData.ID WHERE ListingsMain.listingStatus = 'Current' ".$advSql." LIMIT ".$offset.",".$limit." ";
$sqlPage = mysql_query("SELECT ListingsMain.*,ListingDimData.ID,ListingDimData.bedrooms FROM ListingsMain LEFT JOIN ListingDimData ON ListingsMain.ID=ListingDimData.ID WHERE ListingsMain.listingStatus = 'Current' ".$advSql."") or die( mysql_error() );
///////////////////////////////////////////////////////
$searchQuery = mysql_query($query);
$objects = new Create;
$photos = new Photos;
while($rows = mysql_fetch_assoc($searchQuery))
{
$str = file_get_contents(SCRIPT_PATH."/templates/listingbox.php"); //Grab the template file
$str = str_replace("{LISTING_ID}",$rows['listingID'],$str);
$str = str_replace("{LISTING_NAME}",$rows['listingName'],$str);
$str = str_replace("{LISTING_CITY}",$objects->whatCity($rows['listingCity']),$str);
$str = str_replace("{LISTING_STATE}",$objects->whatState($rows['listingState']),$str);
$str = str_replace("{LISTING_ZIP}",$rows['listingZip'],$str);
$str = str_replace("{LISTING_PRICE}",number_format($rows['listingPrice']),$str);
$str = str_replace("{LISTING_BR}",$rows['bedrooms'],$str);
$linkName = ereg_replace("[^A-Za-z0-9]", "-", $rows['listingName']);
$str = str_replace("{photo1}","<a href='details_".$rows['ID']."/".$linkName.".html'>".$photos->singlePhoto($rows['ID'],100,'')."</a>",$str);
$results .= $str;
}
$nextPrev = file_get_contents(SCRIPT_PATH."/templates/nextprev.php");
foreach($_POST as $key=>$value)
{
$hidden .= "<input name='".$key."' type='hidden' value='".$value."'>";
}
$nextPrev = str_replace("{hidden}",$hidden,$nextPrev);
$keywords = $objects->whatCity($_POST['city']);
$keywords .= ", ".$objects->whatType($_POST['propertyType']);
$keywords .= ", ".$objects->whatCategory($_POST['categoryCode']);
$pageData = $this->createSearchPage($results,$nextPrev,$keywords);
if(mysql_num_rows($searchQuery) >= $limit)
{
$pageData = str_replace("{PAGEFWD}",($_GET['page'] + 1),$pageData);
}else
{
$pageData = str_replace("{PAGEFWD}","1",$pageData);
}
if($_GET['page'] > 1)
{
$pageData = str_replace("{PAGEBACK}",($_GET['page'] - 1),$pageData);
}else
{
$pageData = str_replace("{PAGEBACK}","1",$pageData);
}
$pageData = str_replace("{results_found}",mysql_num_rows($sqlPage),$pageData);
return $pageData;
}else //do a 'keyword' search
{
$limit = $listAmount;
if(!isset($_GET['page']))
{
$page = 1;
}else
{
$page = $_GET['page'];
}
$offset = ($page -1) * $limit;
$objects = new Create;
$photos = new Photos;
$sql = "SELECT ListingsMain.*,ListingDimData.ID,ListingDimData.bedrooms FROM ListingsMain
LEFT JOIN ListingDimData ON ListingsMain.ID=ListingDimData.ID WHERE ListingsMain.listingStatus = 'Current' and
( listingID LIKE '%".$keyword."%' ) OR
( listingName LIKE '%".$keyword."%' ) OR
( listingCity LIKE '%".$keyword."%' ) OR
( listingState LIKE '%".$keyword."%' ) OR
( listingZip LIKE '%".$keyword."%' ) LIMIT ".$offset.",".$limit;
$sqlPage = mysql_query("SELECT ListingsMain.*,ListingDimData.ID,ListingDimData.bedrooms FROM ListingsMain
LEFT JOIN ListingDimData ON ListingsMain.ID=ListingDimData.ID WHERE ListingsMain.listingStatus = 'Current' and
( listingID LIKE '%".$keyword."%' ) OR
( listingName LIKE '%".$keyword."%' ) OR
( listingCity LIKE '%".$keyword."%' ) OR
( listingState LIKE '%".$keyword."%' ) OR
( listingZip LIKE '%".$keyword."%' )") or die( mysql_error() );
//echo $sql;
$query = mysql_query($sql) or die( mysql_error() );
while($rows = mysql_fetch_assoc($query))
{
$linkName = ereg_replace("[^A-Za-z0-9]", "-", $rows['listingName']);
$str = file_get_contents(SCRIPT_PATH."/templates/listingbox.php"); //Grab the template file
$str = str_replace("{LISTING_ID}",$rows['listingID'],$str);
$str = str_replace("{LISTING_NAME}","<a href='".SCRIPT_URL."/details_".$rows['ID']."/".$linkName.".html'>".$rows['listingName']."</a>",$str);
$str = str_replace("{LISTING_CITY}",$objects->whatCity($rows['listingCity']),$str);
$str = str_replace("{LISTING_STATE}",$objects->whatState($rows['listingState']),$str);
$str = str_replace("{LISTING_ZIP}",$rows['listingZip'],$str);
$str = str_replace("{LISTING_PRICE}",number_format($rows['listingPrice']),$str);
$str = str_replace("{LISTING_BR}",$rows['bedrooms'],$str);
$str = str_replace("{photo1}","<a href='details_".$rows['ID']."/".$linkName.".html'>".$photos->singlePhoto($rows['ID'],100,'')."</a>",$str);
$results .= $str;
}
$nextPrev = file_get_contents(SCRIPT_PATH."/templates/nextprev.php");
foreach($_POST as $key=>$value)
{
$hidden .= "<input name='".$key."' type='hidden' value='".$value."'>";
}
$nextPrev = str_replace("{hidden}",$hidden,$nextPrev);
$pageData = $this->createSearchPage($results,$nextPrev,$keyword);
if(mysql_num_rows($query) >= $limit)
{
$pageData = str_replace("{PAGEFWD}",($_GET['page'] + 1),$pageData);
}else
{
$pageData = str_replace("{PAGEFWD}","1",$pageData);
}
if($_GET['page'] > 1)
{
$pageData = str_replace("{PAGEBACK}",($_GET['page'] - 1),$pageData);
}else
{
$pageData = str_replace("{PAGEBACK}","1",$pageData);
}
$pageData = str_replace("{results_found}",mysql_num_rows($sqlPage),$pageData);
return $pageData;
}
//echo "<pre>".print_r($searchQuery)."</pre>"; exit;
}///end searchListings
|