I've just released version 1.21 of my open source PHP links script ssLinks. Unfortunately there are still reports of a bizzare bug in the "Top Rated" function. I have been unable to recreate the problem some people are having and I have a suspicion that the people who are having the problem may be using an earlier version of mySQL.
Here's the SQL that is causing the problem:It's meant to display the top $nol (usually set to 10) rated links from the links database. A link's rating is calulated using link_totalrate / link_numvotes. $minvotes is the minimum number of votes needed for a link to show up on the top rated list (to prevent links with only one vote coming top).Code:$links_sql = "SELECT * FROM sslinks WHERE link_validated = 'yes' AND link_numvotes > $minvotes ORDER BY (link_totalrate / link_numvotes) DESC LIMIT 0,$nol";
A better example of what this does can be seen here:
The code works fine on the machines I have tested it on, but some of my users are reporting that they get a database error on that page.
I'm sure the thing that's throwing it is the ORDER BY clause, but I'm not sure how to achieve the same effect without using that syntax...