Try using a sub-query like this,
PHP Code:
$twentyfourago= TIMENOW - 86400;
$result = $db->query_read("
SELECT *
FROM (
SELECT *
FROM " . TABLE_PREFIX . "thread
WHERE dateline >= $twentyfourago
ORDER BY replycount DESC
LIMIT 7
) as sub_results
ORDER BY dateline DESC
");
$populardisplay = '';
while ($thread = $db->fetch_array($result))
{
$populardisplay .= "<b><a href=\"showthread.php?t=$thread[threadid]\">$thread[title]</a></b>
<br /><span class='smallfont'> by
<a href=\"http://www.nwfans.com/member.php?u=$thread[postuserid]\">$thread[postusername]</a> </span><br />";
}
Another idea is to do it in PHP using array sorting.