order by

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

order by

Post by SidewinderX »

ok i believe this will be my last question and i will finally be done with my project!!! WOOT!!! :lol:

anyway...i have a table, and when you click on one of the table headings for instance "Player" i want it to ORDER BY player or "levels" i want it to display who has the most levels first in decending order or vice versa...i know i can do that in the sql query by ORDER BY... but how can i make a link do that?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

as I've suggested before on this topic: pass the column to sort by (and DESC/ASC info) through the url.
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

An example would be this type of link:

Code: Select all

<a href="person.php?sort=age&order=desc">Sort By Age, Descending</a>
Post Reply