Jump to content

idweb

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.kinkz.co.uk

Profile Information

  • Gender
    Not Telling

idweb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. K iv changed it and im still getting 17 rersults (duplicates) :(
  2. ok here it is [code]<? /************************************************************************* *        cptRealty Real Estate Listing Application *        ©2005 Costa Pacific Technologies. All rights reserved. *        http://www.costapacific.net * *        File Info: search.php v1.1 *        Updated:  02/17/2005 - Lee Hadley ************************************************************************/ require_once("conn.php"); require_once("includes.php"); $query = array(); if(!empty($_GET[c])) { $query[] = "cpt_listings.CategoryID = '$_GET[c]' "; } if(!empty($_GET[s])) { $query[] = "cpt_listings.SubcategoryID = '$_GET[s]' "; } if(!empty($_GET[AgentID])) { $query[] = "cpt_listings.AgentID = '$_GET[AgentID]' "; } if(!empty($_GET[search_province])) { $query[] = "cpt_listings.province = '$_GET[search_province]' "; } if(!empty($_GET[search_country])) { $query[] = "cpt_listings.country = '$_GET[search_country]' "; } if(!empty($_GET[search_area])) { $query[] = "cpt_listings.state = '$_GET[search_area]' or cpt_listings.city = '$_GET[search_area]'"; } if(!empty($_GET[zip_code])) { $query[] = "cpt_listings.zip_code = '$_GET[zip_code]' "; } if(!empty($_GET[search_category])) { $query[] = "cpt_listings.CategoryID = '$_GET[search_category]' "; } if(!empty($_GET[search_subcategory])) { $query[] = "cpt_listings.SubcategoryID = '$_GET[search_Subcategory]' "; } if(!empty($_GET[search_state])) { $query[] = "cpt_listings.state = '$_GET[search_state]' ";      } if(!empty($_GET[search_city])) { $query[] = "cpt_listings.city = '$_GET[search_city]' "; } if(!empty($_GET[search_PropertyType])) { $query[] = "cpt_listings.PropertyType = '$_GET[search_PropertyType]' "; } if(!empty($_GET[MinPrice])) { $query[] = "cpt_listings.price >= '$_GET[MinPrice]' "; } if(!empty($_GET[MaxPrice])) { $query[] = "cpt_listings.price <= '$_GET[MaxPrice]' "; } if(!empty($_GET[rooms1])) { $query[] = "cpt_listings.rooms >= '$_GET[rooms1]' "; } if(!empty($_GET[rooms2])) { $query[] = "cpt_listings.rooms <= '$_GET[rooms2]' "; } if(!empty($_POST[MinRooms])) { $rooms1 = $_POST[MinRooms]; } if(!empty($_POST[MaxRooms])) { $rooms2 = $_POST[MaxRooms]; } if(!empty($_GET[bath1])) { $query[] = "cpt_listings.bathrooms >= '$_GET[bath1]' "; } if(!empty($_GET[bath2])) { $query[] = "cpt_listings.bathrooms <= '$_GET[bath2]' "; } if(!empty($_GET[before])) { $MyDate = strtotime("-$_GET[before]"); $query[] = "cpt_listings.DateAdded >= '$MyDate' "; } if(!empty($_GET[school])) { $query[] = "cpt_listings.NearSchool = 'y' "; } if(!empty($_GET[transit])) { $query[] = "cpt_listings.NearTransit = 'y' "; } if(!empty($_GET[park])) { $query[] = "cpt_listings.NearPark = 'y' "; } if(!empty($_GET[ocean_view])) { $query[] = "cpt_listings.OceanView = 'y' "; } if(!empty($_GET[lake_view])) { $query[] = "cpt_listings.LakeView = 'y' "; } if(!empty($_GET[mountain_view])) { $query[] = "cpt_listings.MountainView = 'y' "; } if(!empty($_GET[ocean_waterfront])) { $query[] = "cpt_listings.OceanWaterfront = 'y' "; } if(!empty($_GET[lake_waterfront])) { $query[] = "cpt_listings.LakeWaterfront = 'y' "; } if(!empty($_GET[river_waterfront])) { $query[] = "cpt_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[] = " cpt_listings.DateAdded desc "; } if($ov == "Price") { $order[] = " cpt_listings.Price asc "; } if($ov == "address") { $order[] = " cpt_listings.address asc "; } } } else { if(!empty($_GET[p])) { $order[] = " cpt_listings.Price asc "; } if(!empty($_GET[r])) { $order[] = " cpt_listings.rooms asc, cpt_listings.bathrooms asc, cpt_listings.garage asc "; } if(!empty($_GET[city])) { $order[] = " cpt_listings.city, cpt_listings.address, cpt_listings.state "; } } if(count($order) > '0') { $MyOrder = implode(", ", $order); } if(empty($MyOrder)) { $MyOrder = " order by cpt_agents.PriorityLevel desc, cpt_listings.DateAdded desc"; } else { $MyOrder = " order by cpt_agents.PriorityLevel desc, $MyOrder"; } if(!empty($_GET[Start])) { $Start = $_GET[Start]; } else { $Start = '0'; } $ByPage = '20'; $q1 = "select * from cpt_listings, cpt_agents where cpt_listings.AgentID = cpt_agents.AgentID and  cpt_agents.AccountStatus = 'active' $MyQuery $MyOrder limit $Start, $ByPage "; $qnav = "select * from cpt_listings, cpt_agents where cpt_listings.AgentID = cpt_agents.AgentID $MyQuery"; $r1 = mysql_query($q1) or die(mysql_error()); $lrows = mysql_num_rows($r1); if($lrows > '0') { $ListingTable .= "<table align=center width=510 border=1 bordercolor=black frame=hsides rules=rows cellspacing=0>"; $ListingTable .= "<p><img src='http://www.angliapropertydirect.co.uk/images/property-search.gif' alt='Property Search East Anglia'></p>"; while($a1 = mysql_fetch_array($r1)) { $ListingTable .= "<tr>\n\t"; if($a1[PriorityLevel] > '1') { $sub = "<span class=RedLink><sup>$a1[PriorityName]</sup></span>"; } $ListingTable .= "\n\t<td width=15>"; if(!empty($a1[image])) { $MyImages = explode("|", $a1[image]); // we need a random number not more than the number of images we have // cjs changed end number to - 1 instead of + 1 so images did not show in random $upper_range = substr_count($a1[image],"|") - 1; $random_ha = rand(1, $upper_range); $i = 1; while(list(,$v) = each($MyImages)) { if ($i == $random_ha) { $img_file = $v; } $i++; } $ListingTable .= "<img src=\"re_images/$img_file\" width=155 height=103 border=0 hspace=10 vspace=10 class=\"table4\">"; } $ListingTable .= "</td>\n\t"; $ListingTable .= "<td width=305><b>$a1[address]</b><br> $a1[state]<br> $a1[city]<br> $a1[province] <br><br>$a1[rooms] Bedrooms $sub</td>\n\t"; $MyPrice = number_format($a1[Price], 0, ".", ""); $ListingTable .= "</td>\n\t<td align=center width=180><b><font style='font-size: 14pt'>" . getCurrentCurrencySymbol($a1[currencyID]) . "$MyPrice</font><br><br><a href=info.php?id=$a1[ListingID]><img border='0' src='http://www.angliapropertydirect.co.uk/images/property_details.gif' width='88' height='25'></a><br><font style='font-size: 12pt'><font color=#CC0000> $a1[HomeAge] </font></td>\n"; $ListingTable .= "</tr>\n"; } $ListingTable .= "</table>"; $rnav = mysql_query($qnav) or die(mysql_error()); $rows = mysql_num_rows($rnav); if($rows > $ByPage) { $ListingTable .=  "<br><table align=center width=510>"; $ListingTable .= "<td align=center><font face=verdana size=2> | "; $pages = ceil($rows/$ByPage); for($i = 0; $i <= ($pages); $i++) { $PageStart = $ByPage*$i; $i2 = $i + 1; if($PageStart == $Start) { $links[] = " <span class=RedLink>$i2</span>\n\t "; } elseif($PageStart < $rows) { $links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&search_country=$_GET[search_country]&search_PropertyType=$_GET[search_PropertyType]&MinPrice=$_GET[MinPrice]&MaxPrice=$_GET[MaxPrice]&rooms1=$_GET[rooms1]&rooms2=$_GET[rooms2]&bath1=$_GET[bath1]&bath2=$_GET[bath2]&before=$_GET[before]&school=$_GET[school]&transit=$_GET[transit]&park=$_GET[park]&ocean_view=$_GET[ocean_view]&lake_view=$_GET[lake_view]&mountain_view=$_GET[mountain_view]&ocean_waterfront=$_GET[ocean_waterfront]&lake_waterfront=$_GET[lake_waterfront]&river_waterfront=$_GET[river_waterfront]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t "; } } $links2 = implode(" | ", $links); $ListingTable .= $links2; $ListingTable .= "| </td>"; $ListingTable .= "</table><br>\n"; } } else { $ListingTable = "<br><br><center>Sorry, no results were found in that category.</center>"; } require_once("templates/HeaderTemplate.php"); require_once("templates/SearchTemplate.php"); require_once("templates/FooterTemplate.php"); ?>[/code] Just to let you know. Im am using costessy for the town and norwich for the city in the search box
  3. Heh i just dont know there or how to stop it looping. Any ideas ? Thanks in advance    Colin
  4. If i use this [code]$query[] = "cpt_listings.state = '$_GET[search_area]' or cpt_listings.city = '$_GET[search_area]'";[/code] It sort of works where it will display the town ok if i search for costessy in the search box but if i put in norwich which is a town i get 16 or 17 duplicate results for each property. Does anybody know why this is ? Thanks Colin
  5. The whole code is below [code]require_once("conn.php"); require_once("includes.php"); $query = array(); if(!empty($_GET[c])) { $query[] = "cpt_listings.CategoryID = '$_GET[c]' "; } if(!empty($_GET[s])) { $query[] = "cpt_listings.SubcategoryID = '$_GET[s]' "; } if(!empty($_GET[AgentID])) { $query[] = "cpt_listings.AgentID = '$_GET[AgentID]' "; } if(!empty($_GET[search_province])) { $query[] = "cpt_listings.province = '$_GET[search_province]' "; } if(!empty($_GET[search_country])) { $query[] = "cpt_listings.country = '$_GET[search_country]' "; } if(!empty($_GET[search_area])) { $query[] = "cpt_listings.state = '$_GET[search_area]'"; } if(!empty($_GET[zip_code])) { $query[] = "cpt_listings.zip_code = '$_GET[zip_code]' "; } if(!empty($_GET[search_category])) { $query[] = "cpt_listings.CategoryID = '$_GET[search_category]' "; } if(!empty($_GET[search_subcategory])) { $query[] = "cpt_listings.SubcategoryID = '$_GET[search_Subcategory]' "; } if(!empty($_GET[search_state])) { $query[] = "cpt_listings.state = '$_GET[search_state]' ";        } if(!empty($_GET[search_city])) { $query[] = "cpt_listings.city = '$_GET[search_city]' "; } if(!empty($_GET[search_PropertyType])) { $query[] = "cpt_listings.PropertyType = '$_GET[search_PropertyType]' "; } if(!empty($_GET[MinPrice])) { $query[] = "cpt_listings.price >= '$_GET[MinPrice]' "; } if(!empty($_GET[MaxPrice])) { $query[] = "cpt_listings.price <= '$_GET[MaxPrice]' "; } if(!empty($_GET[rooms1])) { $query[] = "cpt_listings.rooms >= '$_GET[rooms1]' "; } if(!empty($_GET[rooms2])) { $query[] = "cpt_listings.rooms <= '$_GET[rooms2]' "; } if(!empty($_POST[MinRooms])) { $rooms1 = $_POST[MinRooms]; } if(!empty($_POST[MaxRooms])) { $rooms2 = $_POST[MaxRooms]; } if(!empty($_GET[bath1])) { $query[] = "cpt_listings.bathrooms >= '$_GET[bath1]' "; } if(!empty($_GET[bath2])) { $query[] = "cpt_listings.bathrooms <= '$_GET[bath2]' "; } if(!empty($_GET[before])) { $MyDate = strtotime("-$_GET[before]"); $query[] = "cpt_listings.DateAdded >= '$MyDate' "; } if(!empty($_GET[school])) { $query[] = "cpt_listings.NearSchool = 'y' "; } if(!empty($_GET[transit])) { $query[] = "cpt_listings.NearTransit = 'y' "; } if(!empty($_GET[park])) { $query[] = "cpt_listings.NearPark = 'y' "; } if(!empty($_GET[ocean_view])) { $query[] = "cpt_listings.OceanView = 'y' "; } if(!empty($_GET[lake_view])) { $query[] = "cpt_listings.LakeView = 'y' "; } if(!empty($_GET[mountain_view])) { $query[] = "cpt_listings.MountainView = 'y' "; } if(!empty($_GET[ocean_waterfront])) { $query[] = "cpt_listings.OceanWaterfront = 'y' "; } if(!empty($_GET[lake_waterfront])) { $query[] = "cpt_listings.LakeWaterfront = 'y' "; } if(!empty($_GET[river_waterfront])) { $query[] = "cpt_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[] = " cpt_listings.DateAdded desc "; } if($ov == "Price") { $order[] = " cpt_listings.Price asc "; } if($ov == "address") { $order[] = " cpt_listings.address asc "; } } } else { if(!empty($_GET[p])) { $order[] = " cpt_listings.Price asc "; } if(!empty($_GET[r])) { $order[] = " cpt_listings.rooms asc, cpt_listings.bathrooms asc, cpt_listings.garage asc "; } if(!empty($_GET[city])) { $order[] = " cpt_listings.city, cpt_listings.address, cpt_listings.state "; } } if(count($order) > '0') { $MyOrder = implode(", ", $order); } if(empty($MyOrder)) { $MyOrder = " order by cpt_agents.PriorityLevel desc, cpt_listings.DateAdded desc"; } else { $MyOrder = " order by cpt_agents.PriorityLevel desc, $MyOrder"; } if(!empty($_GET[Start])) { $Start = $_GET[Start]; } else { $Start = '0'; } $ByPage = '20'; $q1 = "select * from cpt_listings, cpt_agents where cpt_listings.AgentID = cpt_agents.AgentID and  cpt_agents.AccountStatus = 'active' $MyQuery $MyOrder limit $Start, $ByPage "; $qnav = "select * from cpt_listings, cpt_agents where cpt_listings.AgentID = cpt_agents.AgentID $MyQuery"; $r1 = mysql_query($q1) or die(mysql_error()); $lrows = mysql_num_rows($r1); if($lrows > '0') { $ListingTable .= "<table align=center width=510 border=1 bordercolor=black frame=hsides rules=rows cellspacing=0>"; $ListingTable .= "<p><img src='http://www.angliapropertydirect.co.uk/images/property-search.gif' alt='Property Search East Anglia'></p>"; while($a1 = mysql_fetch_array($r1)) { $ListingTable .= "<tr>\n\t"; if($a1[PriorityLevel] > '1') { $sub = "<span class=RedLink><sup>$a1[PriorityName]</sup></span>"; } $ListingTable .= "\n\t<td width=15>"; if(!empty($a1[image])) { $MyImages = explode("|", $a1[image]); // we need a random number not more than the number of images we have // cjs changed end number to - 1 instead of + 1 so images did not show in random $upper_range = substr_count($a1[image],"|") - 1; $random_ha = rand(1, $upper_range); $i = 1; while(list(,$v) = each($MyImages)) { if ($i == $random_ha) { $img_file = $v; } $i++; } $ListingTable .= "<img src=\"re_images/$img_file\" width=155 height=103 border=0 hspace=10 vspace=10 class=\"table4\">"; } $ListingTable .= "</td>\n\t"; $ListingTable .= "<td width=305><b>$a1[address]</b><br> $a1[state]<br> $a1[city]<br> $a1[province] <br><br>$a1[rooms] Bedrooms $sub</td>\n\t"; $MyPrice = number_format($a1[Price], 0, ".", ""); $ListingTable .= "</td>\n\t<td align=center width=180><b><font style='font-size: 14pt'>" . getCurrentCurrencySymbol($a1[currencyID]) . "$MyPrice</font><br><br><a href=info.php?id=$a1[ListingID]><img border='0' src='http://www.angliapropertydirect.co.uk/images/property_details.gif' width='88' height='25'></a><br><font style='font-size: 12pt'><font color=#CC0000> $a1[HomeAge] </font></td>\n"; $ListingTable .= "</tr>\n"; } $ListingTable .= "</table>"; $rnav = mysql_query($qnav) or die(mysql_error()); $rows = mysql_num_rows($rnav); if($rows > $ByPage) { $ListingTable .=  "<br><table align=center width=510>"; $ListingTable .= "<td align=center><font face=verdana size=2> | "; $pages = ceil($rows/$ByPage); for($i = 0; $i <= ($pages); $i++) { $PageStart = $ByPage*$i; $i2 = $i + 1; if($PageStart == $Start) { $links[] = " <span class=RedLink>$i2</span>\n\t "; } elseif($PageStart < $rows) { $links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&search_country=$_GET[search_country]&search_PropertyType=$_GET[search_PropertyType]&MinPrice=$_GET[MinPrice]&MaxPrice=$_GET[MaxPrice]&rooms1=$_GET[rooms1]&rooms2=$_GET[rooms2]&bath1=$_GET[bath1]&bath2=$_GET[bath2]&before=$_GET[before]&school=$_GET[school]&transit=$_GET[transit]&park=$_GET[park]&ocean_view=$_GET[ocean_view]&lake_view=$_GET[lake_view]&mountain_view=$_GET[mountain_view]&ocean_waterfront=$_GET[ocean_waterfront]&lake_waterfront=$_GET[lake_waterfront]&river_waterfront=$_GET[river_waterfront]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t "; } } $links2 = implode(" | ", $links); $ListingTable .= $links2; $ListingTable .= "| </td>"; $ListingTable .= "</table><br>\n"; } } else { $ListingTable = "<br><br><center>Sorry, no results were found in that category.</center>"; } require_once("templates/HeaderTemplate.php"); require_once("templates/SearchTemplate.php"); require_once("templates/FooterTemplate.php"); ?>[/code] Thanks Guys
  6. Hi there Thanks for the reply. So what code do you think i should use im a lil nooby do you have something I could paste in ? Thanks Again Col
  7. Hi again. Would it help if I posted all the code that handles the search ? Thanks
  8. Thanks Thorpe Iv tried the code you have written and it does not produce any errors but it does not for some reason produce any resuts. Can i provide any more information ? Thanks Again Colin :)
  9. Wow fast replies. Thank you I tried the one from AndyB And if i search for city it works great. If i search for State I get the same property result all the way down the page duplicated. eg www.angliapropertydirect.co.uk top right search box labeled (Town) strings i am using are.    city = norwich  and state = costessy. Thanks guys for your help
  10. Hi there. I have a simple form on a web page one input box is called search_area the value is passed to a php script and is related to this statement if(!empty($_GET[search_area])) { $query[] = "cpt_listings.state = '$_GET[search_area]' "; } So what ever is typed into search_area will be searched in the database for a result. I think. The problem i have is i would also like it to search or another result which is below. if(!empty($_GET[search_area])) { $query[] = "cpt_listings.city = '$_GET[search_area]' "; } I can use them both independently but not at the same time as one cancels out the other. Basically if some one types in a word that matches either city or state i would like the results to be both not one or the other. Thanks Colin
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.