Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Copy the following in the body of a page and set the input filter to PHP.
$how_many_per_page = 100;
$query = "SELECT {node}.created AS Date, name, type, COUNT(*) AS Total
FROM {node} JOIN {users}
ON {node}.uid = {users}.uid
GROUP BY FROM_DAYS(TO_DAYS(FROM_UNIXTIME({node}.created))), name, type";
$count = "SELECT COUNT(*) FROM (SELECT DISTINCT FROM_DAYS(TO_DAYS(FROM_UNIXTIME({node}.created))) AS DATE, uid, type FROM {node}) AS Data_row";
$results = pager_query($query, $how_many_per_page, 0, $count);
$header = array(t('Date'), t('Name'), t('Type'), t('Total'));
$attributes = array('width' => '75%',
'align' => 'center',
'border' => '2',
);
$rows = array();
while ($quote = db_fetch_array($results)) {
$rows[] = array(date('Y/m/d',$quote['Date']), $quote['name'], $quote['type'], $quote['Total']);
}
if (count($rows)) {
echo theme('table', $header, $rows, $attributes);
echo theme('pager', NULL, $how_many_per_page);
}
else { echo 'No results found'; }