![]() |
Im trying to disply the top viewed threads and did now find a hack to do this. So I tried this but it dont work any ideas on how I can complete this.
// Top 10 Viewed Threads// $top = "10"; // change this to the number of top thread views you want to disply. echo("<table border=0 cellpadding=0 cellspacing=0><tr><td><b>Top Viewed Threads </b></td></tr>"); $topthread = mysql_query("SELECT COUNT(*) AS count,title,views FROM thread ORDER BY count DESC LIMIT $top;"); $lugar=1; while ($topview = mysql_fetch_array($topthread)): if (($counter++ % 2) != 0); echo("<tr><td><strong><big>·</big></strong> $lugar: <a href=\"$bburl/showthread.php?&$topthread[title]\">$topthread[threadid]</a></td><td align=\"center\">$topthreads[views]</td></tr>"); $lugar++; endwhile; echo("</table>"); echo("<br>"); |
I got it to work with this code I just need some help with excluding some forums form it any ideas how to do this
// Top 10 Viewed Threads// $top = "10"; // change this to the number of posters you want to show. echo("<table border=0 cellpadding=4 cellspacing=0><tr><td><b>Top 10 Viewed Threads</b></td><td><br>"); echo("</table>"); echo("<table border=0 cellpadding=0 cellspacing=0><tr><td><b>Thread</b></td><td><b>Viewed</b></td></tr>"); $postsresult = mysql_query("SELECT COUNT(*) AS count,threadid,title,views,forumid FROM thread GROUP BY threadid ORDER BY views DESC LIMIT $top;"); $lugar=1; while ($vthreads = mysql_fetch_array($postsresult)): if (($counter++ % 2) != 0); echo("<tr><td><strong><big>ยท</big></strong> $lugar: <a href=\"$bburl/showthread.php?s&threadid=$vthreads[threadid]\">$vthreads[title]</a></td><td align=\"center\">$vthreads[views]</td></tr>"); $lugar++; endwhile; echo("</table>"); echo("<br>"); |
Add:
Code:
WHERE forumid NOT IN (1,2,3,4,5,...) |
Thanks for the help, When tried
WHERE forumid NOT IN (1,2,3,4,5,...) I got mysql errors so I tried this and it works WHERE forumid<>'1,2,3,4,5' |
But it's not correct, because you checking that the forumid is not equal to the STRING '1,2,3,4,5'. Use my code without the ... (I thought that was obvious).
|
Ok thanks, I had it right the first time I tried your code, I had a nother error in the code that was causing my error I just found
Thanks for the Help |
All times are GMT. The time now is 06:00 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|