Skip to content

Instantly share code, notes, and snippets.

@silentguardian
Created January 27, 2014 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silentguardian/8655070 to your computer and use it in GitHub Desktop.
Save silentguardian/8655070 to your computer and use it in GitHub Desktop.
global $smcFunc;
$result = $smcFunc['db_query']('', '
SELECT DATE(FROM_UNIXTIME(poster_time)) AS date, COUNT(*) AS posts
FROM {db_prefix}messages
WHERE id_member = 1
GROUP BY date
ORDER BY posts',
array(
)
);
$data = array();
while ($row = $smcFunc['db_fetch_assoc']($result))
$data[$row['date']] = $row['posts'];
$smcFunc['db_free_result']($result);
echo '
<table border="1" cellspacing="0" cellpadding="3">
<tr>
<th>Rank</th>
<th>Date</th>
<th>Posts</th>
</tr>';
$counter = 1;
foreach ($data as $date => $posts)
{
echo '
<tr>
<td>', $counter++, '</td>
<td>', $date, '</td>
<td>', $posts, '</td>
</tr>';
}
echo '
</table>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment