This applies to boards hosted on servers running MySQL v5.0.12 or higher.
In trying to get some quirks out of a new board I have been setting up, I ran into an issue where the download area top list, top rated files function was returning an sql error. The error returned was 1054, "Unknown column in f1.file_id as $file_ids"
This feature worked on my own board, but not the new one. Looking at the difference in the server software revealed that the new board was running under MySQL 5.0.25 and my own board was running under version 4.1.22. Figuring that the problem must be related to the database version, I dug into the version 5 MySQL manual and this is what I found.
At v5.0.1, the use of parenthesis for join operations was optional and the operation read from left to right. At v5.0.12, some operations required the use of parenthesis to bring MySQL into compliance with the sql standard. Think of it like a simple math equation. If you put the parenthesis in a different place, you can change the result.
So with this in mind, I came up with the following fix
#
#-----[ OPEN ]------------------------------------------
#
/pafiledb/modules/pa_toplist.php
#
#-----[ FIND ]------------------------------------------
#
FROM " . PA_FILES_TABLE . " AS f1, " . PA_CATEGORY_TABLE . " AS c
#
#-----[ REPLACE WITH ]------------------------------------------
#
FROM (" . PA_FILES_TABLE . " AS f1, " . PA_CATEGORY_TABLE . " AS c)
#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#
#End
This fix must be applied twice as the [FIND] occurs twice, once at line 194 and again at line 406 in an unmodified file.
I ran the search function to ensure this line only occurred twice in the file