Different implementation of query I have the following query. I use phpmyadmin for testing and it executes perfectly. However when I try to use it in my server application I always get null on rank

SET @_c = 0;
SELECT kills,deaths,revives,damage,levels,rank,skill
FROM (
    SELECT 
        *, 
        (@_c \:= @_c + 1) AS `rank`, 
        ((kills + damage + levels)/(deaths+revives+1)) AS skill 
    FROM leaderboard 
    ORDER BY skill DESC) AS newtable 
WHERE soldier_id = 1(example)


I am looking either for another implementation or idea how to fix it.

Edit: I put (example) because soldier_id can be 1,2, or 3000. It not constant that what i am trying to say. And i have to use : because i use hibernate in java which requires it.
try..

SET @_c = 0;
SELECT kills,deaths,revives,damage,levels,rank,skill  
FROM (  SELECT  *,  (@_c \:= @_c + 1) AS `rank`,   
        ((kills + damage + levels)/(deaths+revives+1)) AS skill   
    FROM leaderboard   ) AS newtable   
WHERE soldier_id = 1(example)
ORDER BY skill DESC;


check for NOT NULL values in cols: kills, damage, levels, deaths, revives