Well, in my forum where it show the "thread views" it only shows 1 more than the number of replys...
See for your self:
http://animeomega.com/foro/forumdisplay.php?f=2
For example:
Views: 10
Replys: 9
Here's the PHP CODE for my threadviews.php
PHP Code:
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($DB_site))
{
exit;
}
$threads = $DB_site->query("SELECT threadid , COUNT(*) AS views FROM " . TABLE_PREFIX . "threadviews GROUP BY threadid");
while ($thread = $DB_site->fetch_array($threads))
{
$DB_site->query(
"UPDATE " . TABLE_PREFIX . "thread
SET views = views + " . intval($thread['views']) . "
WHERE threadid = " . intval($thread['threadid'])
);
}
$threads = $DB_site->query("SELECT distinct threadviews.threadid,+++++adid,+++++adname,+++++ad FROM ".TABLE_PREFIX."threadviews AS threadviews INNER JOIN ".TABLE_PREFIX."thread AS thread ON threadviews.threadid=thread.threadid ORDER BY threadid");
$threadidcache = 0;
while ($thread = $DB_site->fetch_array($threads))
{
// either is the first row or a new set of threadid's is coming
if ($threadidcache != $thread['threadid'])
{
if ($threadidcache)
{
asort($+++++adarray);
$DB_site->query("UPDATE ".TABLE_PREFIX."thread SET +++++ad='".addslashes(serialize($+++++adarray))."' WHERE threadid='".$threadidcache."'");
}
$+++++adarray = unserialize($thread['+++++ad']);
}
if ($thread['+++++adid'])
{
$+++++adarray[$thread['+++++adid']] = $thread['+++++adname'];
}
$threadidcache = $thread['threadid'];
}
// get the last one that the loop couldn't get
if (!empty($+++++adarray))
{
$DB_site->query("UPDATE ".TABLE_PREFIX."thread SET +++++ad='".addslashes(serialize($+++++adarray))."' WHERE threadid='".$threadidcache."'");
}
log_cron_action('Thread Views Updated', $nextitem);
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "threadviews");
Well if anyone can help =(
THANKS =)