# Can someone help me with this search query?

**URL:** <https://forum.kirupa.com/t/can-someone-help-me-with-this-search-query/238972>\
**Category:** programming\
**Created:** [September 17, 2007, 4:37pm UTC](https://forum.kirupa.com/t/can-someone-help-me-with-this-search-query/238972 "2007-09-17T16:37:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pp4sale](https://avatars.discourse-cdn.com/v4/letter/p/ee7513/32.png) [@pp4sale](https://forum.kirupa.com/u/pp4sale)\
**Post date:** [September 17, 2007, 4:37pm UTC](https://forum.kirupa.com/t/can-someone-help-me-with-this-search-query/238972/1 "2007-09-17T16:37:39Z")

</div>

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!!!
