H guys
I just need a select query which will have return new position column in it i.e
i want the result to be
id score position
23 345 1
09 309 2
12 123 3
I tried this but didn't work
(SELECT @rownum := @rownum + 1 AS position,
id,
score
FROM tabs
ORDER BY score DESC");
position row was empty, please help using php
SELECT @rownum := @rownum + 1 AS position,
id,
score
FROM tabs, (SELECT @rownum:=0) AS initrownum
ORDER BY score DESC
your query should be like :SELECT id, score FROM tabs ORDER BY score DESC
and your php:for($i = 0; $i < sizeof($result); $i++){
echo $i;
echo $result['id'][$i];
echo $result['score'][$i]
//br the line here
}