How to take the larger value and use in PHP query
<p>I have a field on a real estate search form asking for Min to Max number of bedrooms. The PHP query extract to return the search results is;</p>

<pre><code>//check bedrooms
if(!empty($_GET["room_no_min"]) &amp;&amp; is_numeric($_GET["room_no_min"])){
     $query[] = "'No_Bedrooms' &gt;= '".$_GET["room_no_min"]."'";
     $room_min_val = $_GET["room_no_min"];
}
if(!empty($_GET["room_no_max"])){
     $query[] = "'No_Bedrooms' &lt;= '".$_GET["room_no_max"]."'";
     $room_max_val = $_GET["room_no_max"];
}
</code></pre>

<p>Which is fine, but I want it to take into account if someone enters the value 5 (min) to 2 (max) i.e. the other way round than they are suppose to. I don't want to use validation I'd rather the query could be something like <code>from =&gt;min(room_no_min,room_no_max)</code> and <code>&lt;=  max(room_no_min,room_no_max)</code> but not sure how to re-write the query.</p>
