the problem is that you reuse the $result var. first you select all users and then you begin to loop through the results. the you fill results with your second query that gets the ranking. So the results of the first one are lost.
just use another var for your second query.
btw. it's not a good idea to do a query for each user to get it's ranking. try to use a join instead. (the advantage is: if you have 200 users in your DB you need to do 201 queries to show each user and it's rank, with a join you only do ONE query... see? g)