MyBB Community Forums

Full Version: PHPMyAdmin Query to find..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Could I do a complex search in PHPMyAdmin to find how many posts users have made in the past twenty-four hours?
when you log into admin panel, the dashboard gives statistics. it includes number of posts for the day.
(2013-04-18, 03:48 PM).m. Wrote: [ -> ]when you log into admin panel, the dashboard gives statistics. it includes number of posts for the day.

I don't want that.. Did you read my thread? I want to host a contest where users post 100 times and they win free VIP.
Do you want to find the number of post 1 user has made by UID? If so, that's pretty easy.
(2013-04-18, 03:59 PM)Euan T Wrote: [ -> ]Do you want to find the number of post 1 user has made by UID? If so, that's pretty easy.

No no. Here's an example:

User 5 has already made 540 posts and so has 100+ members so it's un-trackable really.

User 5 makes 100 posts and legitimately wins free VIP from my contest. He PMs me saying so. I might not believe him or for another reason.

Could I check through PHPMyAdmin if user 5 has made 100 posts in the last 24 hours?
SELECT u.uid, u.username, s.total
FROM mybb_users u
INNER JOIN (
SELECT uid, count( * ) AS total
FROM `mybb_posts` 
WHERE dateline >= ( UNIX_TIMESTAMP( NOW( ) ) - ( 24 *60 *60 ) ) 
GROUP BY uid
)s ON u.uid = s.uid
ORDER BY s.total DESC

change mybb_ to your prefix and if you want to change the number of days multiple the 24 times the number of days you want, like 5 days would be ( 5 * 24 * 60 * 60)
(2013-04-18, 04:21 PM)pavemen Wrote: [ -> ]
SELECT u.uid, u.username, s.total
FROM mybb_users u
INNER JOIN (
SELECT uid, count( * ) AS total
FROM `mybb_posts` 
WHERE dateline >= ( UNIX_TIMESTAMP( NOW( ) ) - ( 24 *60 *60 ) ) 
GROUP BY uid
)s ON u.uid = s.uid
ORDER BY s.total DESC

change mybb_ to your prefix and if you want to change the number of days multiple the 24 times the number of days you want, like 5 days would be ( 5 * 24 * 60 * 60)

Amazing, thank-you! Rep heading your way mister. Heart