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
    New Coder
    Join Date
    Jul 2011
    Posts
    52
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Ordering table by count of

    Hello. I have matches table that looks like this:
    PLAYER 1 | PLAYER 2 | WINNER

    table name: league_battles

    I need to order this table in PHP by the number of wins of a player.
    most wins = top of the table, to the lowest.

    How I can do this?
    Need domain? Buy Cheap Domain at Rapid Host :)

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,021
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Trivial, except you don't tell us how that data tells you WHICH ONE is the winner!

    Does the table look like this:
    Code:
    player1 | player2 | winner
          7 |      13 | 13
          2 |      22 | 2
    or what?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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