Sorry if it's been asked before but I think this might be very specific to the query..I'm very new to both PHP and SQL but got a high scores system working and now stuck on one last thing...I have a query that if I paste into phpmyadmin it works fine, but when included between $sql ="" (in PHP) it doesn't.
In a vain attempt to debug it calling via a browser I can see the offending item just can't see why, in PHP:
$sql = "SET @rownum := 0; SELECT * FROM (SELECT @rownum := @rownum+1 AS rank, ID, Username, Score, UDID FROM users ORDER BY Score DESC)
AS derived_table WHERE Username = 'Dave';";
This returns nothing...but paste it into phpmyadmin and it works fine, returns two entries sorted by score and displaying their rank.
If I remove SET @rownum := 0; then it works but returns null for rank...so I guess the ; is causing it to terminate?
Any ideas would be a big help before I pull the last piece of hair out.