471,872 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,872 software developers and data experts.

selectbox dynamic range options

i would like to dynamically output such a selectbox below using php
and mysql:
<option< 100 </option>
<option100 to 150 </option>
<option150 to 200 </option>
<option200 to 250 </option>
<option250 to 300</option>
<option 300 </option>

the selectbox will show a range of available prices of products in a

the table has the following fields:

so depending on the actual prices in the table, the selectbox will

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


Aug 14 '07 #1
1 1866
giloosh wrote:
On Aug 14, 8:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>giloosh wrote:
>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.
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 NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.