View Full Version : top posters over a 7 day period
sabret00the
11-04-2003, 08:05 PM
how would i edit this query to show the top posters over a 7 day period?
$posts10 = $DB_site->query('SELECT userid,username,posts FROM user ORDER BY posts DESC LIMIT 5');
sabret00the
11-04-2003, 10:51 PM
*bump*
Issvar
11-05-2003, 08:17 AM
SELECT
userid,
username,
COUNT(*) as weekpostcount
FROM
post
WHERE
dateline > (UNIX_TIMESTAMP() - 7*24*60*60)
GROUP BY
username,
userid
ORDER BY
weekpostcount DESC
LIMIT 5
For Help Me Finish it's usual to try doing something yourself first, otherwise post in MySQL/PHP
sabret00the
11-05-2003, 12:55 PM
altho i appreciate your help, the query is apart of something
$posts10 being the function i'm declaring
and
$DB_site->query('SELECT userid,username,posts FROM user ORDER BY posts DESC LIMIT 5');
being the string that query's the database, as you can see in the php box in the first post i don't apprear to make use of the function anywhere, which would mean that i got the rest of the hack somewhere else (of which i require no help with), being that this is the last obstacle before finish, i would say it's a matter of HELP ME FINISH
btw your query didn't work :)
Lesane
11-05-2003, 02:07 PM
Execute the query in phpmyadmin, it does work ;)
sabret00the
11-06-2003, 05:51 AM
sorry should've been clearer, the query works fine in php my admin just not on the page :(
Lesane
11-06-2003, 06:22 AM
Post the php code with query so we can help you.
assassingod
11-06-2003, 06:29 AM
$toppostersquery = $DB_site->query("
SELECT
userid,
username,
COUNT(*) as weekpostcount
FROM
post
WHERE
dateline > (UNIX_TIMESTAMP() - 7*24*60*60)
GROUP BY
username,
userid
ORDER BY
weekpostcount DESC
LIMIT 5
");
while ($topposters = $DB_site->fetch_array($toppostersquery))
{
eval("\$toppostersbit = \"".gettemplate('topposters_7days')."\";");
}
Then you'd use something like in the topposters_7days template:
<b>$topposters[username]</b> -$topposters[posts]
Untested but that should do it for you
sabret00the
11-10-2003, 12:45 AM
when i get access to my pc i'll post it up, thank you very much for all of your help thus far tho :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.