You are here

function statistics_title_list in Drupal 5

Same name and namespace in other branches
  1. 8 core/modules/statistics/statistics.module \statistics_title_list()
  2. 4 modules/statistics.module \statistics_title_list()
  3. 6 modules/statistics/statistics.module \statistics_title_list()
  4. 7 modules/statistics/statistics.module \statistics_title_list()

Returns all time or today top or last viewed node(s).

Parameters

$dbfield: one of

  • 'totalcount': top viewed content of all time.
  • 'daycount': top viewed content for today.
  • 'timestamp': last viewed node.

$dbrows: number of rows to be returned.

Return value

A query result containing n.nid, n.title, u.uid, u.name of the selected node(s) or FALSE if the query could not be executed correctly.

1 call to statistics_title_list()
statistics_block in modules/statistics/statistics.module
Implementation of hook_block().

File

modules/statistics/statistics.module, line 427
Logs access statistics for your site.

Code

function statistics_title_list($dbfield, $dbrows) {
  return db_query_range(db_rewrite_sql("SELECT n.nid, n.title, u.uid, u.name FROM {node} n INNER JOIN {node_counter} s ON n.nid = s.nid INNER JOIN {users} u ON n.uid = u.uid WHERE %s <> '0' AND n.status = 1 ORDER BY %s DESC"), 's.' . $dbfield, 's.' . $dbfield, 0, $dbrows);
}