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 3 of 3

Thread: array sorting

  1. #1
    New Coder
    Join Date
    Feb 2007
    Location
    FL
    Posts
    35
    Thanks
    4
    Thanked 0 Times in 0 Posts

    array sorting

    array sorting
    I have a array that holds 2 values a userid and a score.

    but i want to show the hiest scores on top.
    but its not working. this is what i am trying

    PHP Code:
    PHP Code:
    $array_userid_score['score'][$count_userid_score]     = 1;
    $array_userid_score['users_id'][$count_userid_score]     = 0;

    $array_userid_score['score'][$count_userid_score]     = 10;
    $array_userid_score['users_id'][$count_userid_score]     = 1;

    $array_userid_score['score'][$count_userid_score]     = 9;
    $array_userid_score['users_id'][$count_userid_score]     = 2;

    $array_userid_score['score'][$count_userid_score]     = 15;
    $array_userid_score['users_id'][$count_userid_score]     = 3;

    $array_userid_score['score'][$count_userid_score]     = 6;
    $array_userid_score['users_id'][$count_userid_score]     = 4;

    asort ($array_userid_score); 
    But I am not getting it by the score

    Thanks for the help

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    John

  • Users who have thanked PappaJohn for this post:

    moiseszaragoza (01-18-2010)

  • #3
    New Coder
    Join Date
    Feb 2007
    Location
    FL
    Posts
    35
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by PappaJohn View Post
    That was just what i needed


  •  

    Posting Permissions

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