Forum Moderators: phranque

Message Too Old, No Replies

Sort list by alpha or number

Best way to do it?

         

kriskd

5:44 pm on Oct 26, 2004 (gmt 0)

10+ Year Member



I want to add a houses for sale section on my website that would just be a simple text list containing the house's address and price. I'd like to provide the option for the user to sort the list by street name or price by clicking the appropriate button.

I'm certainly not asking anyone to do this for me and I look forward to a good challenge. What I am looking for is finding out what would be the best way to approach this. Is this something PHP could accomplish? What would be my best option to explore?

kpaul

11:50 pm on Oct 26, 2004 (gmt 0)

10+ Year Member



maybe let them sort by both?

sorting by number would be easier, imho, because the numbers are (presumably) at the beginning of the string.

-kpaul

kriskd

12:13 am on Oct 27, 2004 (gmt 0)

10+ Year Member



I'm sorry, I didn't make myself too clear.

I already know I want to provide my users with the ability to sort the list by either price or street name. I envision 2 buttons that execute and display the list as appropriate.

My question is what is the best way to achieve this? My own thought was put the data into a MySql db and use PHP to execute it. Does this make sense or is there a better (and perhaps easier) way to do this?

kpaul

1:49 am on Oct 27, 2004 (gmt 0)

10+ Year Member



oh, i thought you meant sort by house number or street address.

you should just be able to do a sort by in mysql...maybe make the row headers links to different parts of the script where you sort with your SQL...

hope that helps some...

-kpaul