源程序如下:
$replythreads = '';
$query = $db->query("SELECT t . fid , f . fup , f . name ,t.author,t.views, t . tid , t . subject ,t . dateline FROM {$tablepre}threads t LEFT JOIN {$tablepre}forums f ON f . fid =t . fid where t.fid<>25 and t.fid<>31 ORDER BY `t` . `views` DESC LIMIT 0, 11");
while($thread = $db->fetch_array($query)) {
$thread[subject] = cutstr($thread[subject], $listlength);
$thread[lastpost] = gmdate("Y-m-j g:i", $thread[lastpost] + $timeoffset * 3600);
$replythreads.="<table width='98%' border='0'align='center' cellspacing='0' cellpadding='2'><tr><a href='forumdisplay.php?fid=$thread[fid]' target='_blank' class='mainlink3'>[$thread[name]]</a> <a href='viewthread.php?tid=$thread[tid]' target='_blank' title='作者:$thread[author] 查看:$thread[views]' class='mainlink1'><font color='#1111cc'>$thread[subject]</font></a></td></tr></table>";
}目前SQl定义的是点击率最高的11条列出来(没有时间限制,所以论坛里面一直是那11个在上面),我想要论坛里面一周内点击率最高的列出来,这样的话每周都会有变化,会显得论坛更新得很快,请高手帮助!
$replythreads = '';
$query = $db->query("SELECT t . fid , f . fup , f . name ,t.author,t.views, t . tid , t . subject ,t . dateline FROM {$tablepre}threads t LEFT JOIN {$tablepre}forums f ON f . fid =t . fid where t.fid<>25 and t.fid<>31 ORDER BY `t` . `views` DESC LIMIT 0, 11");
while($thread = $db->fetch_array($query)) {
$thread[subject] = cutstr($thread[subject], $listlength);
$thread[lastpost] = gmdate("Y-m-j g:i", $thread[lastpost] + $timeoffset * 3600);
$replythreads.="<table width='98%' border='0'align='center' cellspacing='0' cellpadding='2'><tr><a href='forumdisplay.php?fid=$thread[fid]' target='_blank' class='mainlink3'>[$thread[name]]</a> <a href='viewthread.php?tid=$thread[tid]' target='_blank' title='作者:$thread[author] 查看:$thread[views]' class='mainlink1'><font color='#1111cc'>$thread[subject]</font></a></td></tr></table>";
}目前SQl定义的是点击率最高的11条列出来(没有时间限制,所以论坛里面一直是那11个在上面),我想要论坛里面一周内点击率最高的列出来,这样的话每周都会有变化,会显得论坛更新得很快,请高手帮助!
global $dsql,$ntime;
$y = strftime("%Y",$ntime);
$time = GetMkTime("{$y}-01-01");
$row = $dsql->GetOne("Select ...... where senddate>=$time; "); //一周的数据
return $row['dd'];