I have a search box where people can search property by country, region and price. But at teh moment the search ranges, min and max, have all the various prices that people have inputed!! So I have a huge list for people to select from.
Can someone please tell me how I would get a query that would search a range eg £0-100,000, £101,000-200,000 etc and pull out listings that fall in those price bands?
Here’s my code at the moment:
if(!empty($_POST[‘MinPrice’]))
{
$MinPrice = $_POST[‘MinPrice’];
}
if(!empty($_POST[‘MaxPrice’]))
{
$MaxPrice = $_POST[‘MaxPrice’];
}
//create the Price Minimum menu
$MinPrice = “<select name=MinPrice>
<option value=”">Minimum</option>
“;
$q1 = “select distinct Price from re_listings order by Price asc”;
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) > ‘0’)
{
while($a1 = mysql_fetch_array($r1))
{
$prices .= “<option value=”$a1[Price]”>€ $a1[Price]</option>
“;
}
}
$MinPrice .= $prices.”</select>
";
//create the max price menu
$MaxPrice = “<select name=MaxPrice>
<option value=”">Maximum</option>
“;
$MaxPrice .= $prices.”</select>
";
Thanks!!!