|
Posted by giloosh on 08/14/07 23:01
i would like to dynamically output such a selectbox below using php
and mysql:
<select>
<option> < 100 </option>
<option> 100 to 150 </option>
<option> 150 to 200 </option>
<option> 200 to 250 </option>
<option> 250 to 300</option>
<option> > 300 </option>
</select>
the selectbox will show a range of available prices of products in a
table
the table has the following fields:
ID
PRICE
ITEM
so depending on the actual prices in the table, the selectbox will
vary.
if the cheapest thing is $1 and the most expensive thing is $1,000,
then the selectbox will change accordingly.
it will break the prices from $1 to $1,000 into categories:
for example...
< 10
10 to 500
500 to 900
>900
i don't know what kind of sql to write to achieve something like this
could you please guide me in the right way to get started on something
like this?
a good example is: on froogle.com
they also have a similar price range search, which is dynamically
generated according to actual search results.
thanks!
Navigation:
[Reply to this message]
|