You are here

function votingapi_select_results in Voting API 6.2

Same name and namespace in other branches
  1. 6 votingapi.module \votingapi_select_results()
  2. 7.2 votingapi.module \votingapi_select_results()

Select cached vote results from the database.

Parameters

$criteria: A keyed array used to build the select query. Keys can contain a single value or an array of values to be matched. $criteria['vote_cache_id'] (If this is set, all other keys are skipped) $criteria['content_id'] $criteria['content_type'] $criteria['value_type'] $criteria['tag'] $criteria['function'] $criteria['timestamp'] (If this is set, records with timestamps GREATER THAN the set value will be selected.)

$limit: An optional integer specifying the maximum number of votes to return.

Return value

An array of vote results matching the criteria.

1 call to votingapi_select_results()
votingapi_select_single_result_value in ./votingapi.module
Retrieve the value of the first result matching the criteria passed in.

File

./votingapi.module, line 369
A generalized voting API for Drupal.

Code

function votingapi_select_results($criteria = array(), $limit = 0) {
  $cached = array();
  $result = _votingapi_select('cache', $criteria, $limit);
  while ($cache = db_fetch_array($result)) {
    $cached[] = $cache;
  }
  return $cached;
}