PHP, SQL code not working as expected
I have a search and pagination script which runs fine if I use the query:
Select * from results
However when I try to use the query:
SELECT id, name, team, points, @curRank := @curRank + 1 AS position FROM results, (SELECT @curRank := 0) r ORDER BY points DESC
This pulls all the correct data through and creates the extra column position, but stops the pagination working so all the records are shown and the search function does not work.
What would I need to change to get it to work? Any ideas would be appreciated