我有一个成员脚本,它有两个表(users
和msgs
)。
我希望每天都有顶级会员发帖子。我使用了这段代码,但它不起作用:
$start = TIMENOW - TIMENOW % 86400;
$end = $start + 86400;
$maxposter = mysql_query("SELECT users.name,users.id,count(*) total FROM users AS users,msgs AS msgs WHERE users.id=msgs.userid AND msgs.added_date BETWEEN $start AND $end GROUP BY msgs.userid ORDER BY total DESC LIMIT 1")or die(mysql_error());
$maxmsg=mysql_fetch_assoc($maxposter);
echo $maxmsg[name];
行added_date
的存储方式与2011-05-05
类似。