OZONE Asylum
Forums
Server-Side Scripting - Oh my!
Sort by last name (PHP - MySQL)
This page's ID:
28658
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
continuing from here : [28625] I have added a sort function to sort the contacts from what branch (city)they are located in. [code] //sorting query. User chooses a branch and sorts the names according to branch. if(isset($_POST['sort'])){ //check to see if the button was pushed switch($_POST['location']){ case "Greensboro": $query = "SELECT * FROM contact WHERE location = 'Greensboro' ORDER BY lastname ASC"; break; case "Hickory": $query = "SELECT * FROM contact WHERE location = 'Hickory' ORDER BY lastname ASC"; break; default: $query = "SELECT * FROM contact ORDER BY lastname ASC"; } }else{ $query = "SELECT * FROM contact ORDER BY lastname ASC"; } [/code] Now...I would like to be able to sort these not only by the city but by their last name. So everyone with the last name beginning with "A", etc... [b]Or[/b] by just the last name. I have the alphabet as links above the page so the user can just click on the letter. Does that make sense? I am having a bit of trouble figuring out how to add not only the branch sort (which is working perfect) but to also add the sort by last name. Any suggestions? Thanks in advance! Later, C:\
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail