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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Edinburgh, UK
    Posts
    402
    Thanks
    2
    Thanked 1 Time in 1 Post

    Ordering a list of data

    I have list of data on one of the pages of my website. The default order is by the "points" which is great but unfortunately it orders it in the wrong direction i.e. 0 comes before 12. Is there a simple piece of PHP I can "call" when the page opens that will reorder the data to be the "correct" direction i.e. 12 comes higher in the list than 0.

    Any help would be greatly appreciated.

    Many thanks in advance
    Rich

    "An expert is a person who has made all the mistakes that can be made in a very narrow field."

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Some of us have psychic powers but some relevant code or additional information might help.

    If you select the data from a db, then you should do the ordering in sql.
    something like
    $sql ="SELECT var1, var2, points FROM table ORDER BY points desc"

  • #3
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please do not crosspost
    Ordering the data in my database

    Please read
    http://www.codingforums.com/postguide.htm


    I suppose this hread may be closed ?

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    That is correct.

    Closing...
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

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