1、調(diào)用會(huì)員發(fā)布文章數(shù)
<table>[e:loop={'SELECT userid, username, count(username) as total from [!db.pre!]ecms_news group by username order by total desc',0,24,0}]<tr><td><?=$bqno?></td><td><?=$bqr[username]?></td><td><?=$bqr[total]?></td></tr>[/e:loop]</table>2、只調(diào)用會(huì)員發(fā)布文章數(shù),增加(序號(hào)、會(huì)員id)
<table><tr><td>排名號(hào)</td><td>會(huì)員名</td><td>文章數(shù)</td><td>會(huì)員ID</td></tr>[e:loop={'select userid, username,count(username) as num from [!db.pre!]ecms_news group by username order by num desc',0,24,0}]<tr><td><?=$bqno?></td><td><?=$bqr[username]?></td><td><?=$bqr[num]?></td><td><?=$bqr[userid]?></td></tr>[/e:loop]</table>注釋:在sql語句“ SELECT userid, username, count(username) as total from [!db.pre!]ecms_news group by username order by total desc ”
中的“(username)”和“group by username”中的 “username”也能用 “userid” 調(diào)用 但會(huì)出項(xiàng)一個(gè)問題就是 管理員的ID會(huì)與前臺(tái)會(huì)員的ID重復(fù)
即:管理員的ID=1,前臺(tái)會(huì)員的ID=1(所以管理員的ID=前臺(tái)會(huì)員的ID),最后統(tǒng)計(jì)出來的文章會(huì)是:管理員+前臺(tái)會(huì)員=總數(shù)
月排行
where newstime > UNIX_TIMESTAMP()-86400*30 (月:30、周:7)
舉例:月排行
<table><tr><td>排名號(hào)</td><td>會(huì)員名</td><td>文章數(shù)</td><td>會(huì)員ID</td></tr>[e:loop={'select userid, username,count(username) as num from [!db.pre!]ecms_news where newstime > UNIX_TIMESTAMP()-86400*7 group by username order by num desc',0,24,0}]<tr><td><?=$bqno?></td><td><?=$bqr[username]?></td><td><?=$bqr[num]?></td><td><?=$bqr[userid]?></td></tr>[/e:loop]</table>
新聞熱點(diǎn)
疑難解答
圖片精選