CODE
SET @rownum := 0;
SELECT * FROM (SELECT @rownum := @rownum+1 AS rank, id, score FROM profiles ORDER BY score DESC) AS derived_table
SELECT * FROM (SELECT @rownum := @rownum+1 AS rank, id, score FROM profiles ORDER BY score DESC) AS derived_table
Które daje prawidłowe wyniki w PhpMyAdmin. Ale już w PHP przy użyciu mysql_query daje oto taki efekt:
CODE
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * FROM (SELECT @rownum := @rownum+1 AS rank, id, score FROM profiles ORDE' at line 1
Jak widać mysql_query urżnął zapytanie. O.o
Skąd takie cuda?