Hi
I have a search engine which has a drop down menu field for searching criterion.
<select name="price">
<option value="0">Select All</option>
<option value="2">Below 200</option>
<option value="10">201 - 1000</option>
<option value="50">1001 or Above</option>
</select>
$price = trim($_POST['price']);
$query = "SELECT productid, price FROM product where price = $price";
Product Table
productid price
1 100
2 400
3 8000
4 900
My questions are:
1) If user selects all in option with '0' value, there is no output. But, I want to show all data in product table.
2) If user selects 201 - 1000 which has '10' as value, there is no output. But, I want to select a range of price inbetween 201-1000 which should show 3 rows of data in above example.
How can I do these 2 tasks in SQL?
Thanks for help.