Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    459
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Sorting Members By Clicking Link

    Hi all,

    I am at a point where I have been able to show all my members that are in my MySQL database... When it displays the list it only shows this info:

    FirstName
    LastName
    State
    LastLogin

    But it automatically sorts the members by the userId, that's fine for the moment. But how can I make the headings at the top of the list into links that when clicked on sort. So for example if you click on 'Last Name' it will sort all the members by their last name alphabetically, and if you click it again it reverses the sort... Anyone seen this before or have any idea how to do it?

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Link the sort type and the order in the url. page.php?sort=field&order=desc
    Check the user input to make sure it's valid and have a default order.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •