After calling my function, you can use these two queries :
PHP Code:
// query THREAD table, for top REPLIED TO thread
$topReplyThread_result = $DB_site->query("SELECT *
FROM thread WHERE $whereClause visible=1 AND open=1
ORDER BY replycount DESC
LIMIT $return_limit");
// query THREAD table, for top VIEWED thread
$topViewedThread_result = $DB_site->query("SELECT *
FROM thread WHERE $whereClause visible=1 AND open=1
ORDER BY views DESC
LIMIT $return_limit");
... those are included in the example I previously gave for your needs... but I chose to only query specific fields.... the two here, i've put the '*' when SELECTing, so that you get all fields returned.
... and i've also taken out the :
PHP Code:
if ($forumsCannotView_strList != "") {... statements ...}
.... bit, because, as I said previously, it's abit sloppy in places... the WHERE clause that is generated with this :
PHP Code:
// generate WHERE clause for non-viewable forums, if any
$whereClause = ($forumsCannotView_strList != "") ? ("(forumid NOT IN ($forumsCannotView_strList)) AND") : ("");
.. after calling my function, sorts it out.