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
    Kal
    Kal is offline
    Regular Coder
    Join Date
    Dec 2005
    Posts
    309
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sorting displayed results

    Hi,

    i have a script which will display a number of records in a table using php and mysql. once they are displayed, is there anyway that one of the headers in the table could act as a drop down menu to re-sort the records?

    thanks in advance.

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    yeah you'd just need some javascript on a <select> field maybe... then either refresh the page and put a "where" in your SQL which will get it from the URL.. .eg:

    mypage.php?sorton=postcode&orderby=asc

    SELECT * FROM myTable ORDER BY $_GET['sorton'] $_GET['orderby']

    you could do this with ajax which would be nicer for the user - ie: no page refreshing and it's all done in the background


  •  

    Posting Permissions

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