469,609 Members | 1,829 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

selectbox dynamic range options

i would like to dynamically output such a selectbox below using php
and mysql:
<select>
<option< 100 </option>
<option100 to 150 </option>
<option150 to 200 </option>
<option200 to 250 </option>
<option250 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!

Aug 14 '07 #1
1 1808
giloosh wrote:
On Aug 14, 8:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>giloosh wrote:
options?
>There you'll have to get all of the prices, sort them and figure out
what your ranges should be.

Yea, makes sense. I would grab all of the prices and put them into one
array and do a bunch of sorting with the array. Could you please give
me an example of what kind of sorting i could do with the array of
prices? I am still a but stuck on that.
Thank you very much for your help!
Check out http://us.php.net/manual/en/function.sort.php and
http://us.php.net/manual/en/function.asort.php for starters.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 15 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Tole | last post: by
6 posts views Thread by Piotr Pietrowski | last post: by
13 posts views Thread by mr_burns | last post: by
7 posts views Thread by Erwin Moller | last post: by
1 post views Thread by shankwheat | last post: by
4 posts views Thread by shankwheat | last post: by
2 posts views Thread by shankwheat | last post: by
4 posts views Thread by evanburen | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.